diff --git a/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go b/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go index 9c15b8740..1d2502b5c 100644 --- a/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/generate/template/base/main.tmpl.go @@ -11,7 +11,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options/windows" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS //go:embed build/appicon.png diff --git a/v2/cmd/wails/internal/commands/initialise/templates/base/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/base/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/base/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/base/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/generate/plain/main.go.tmpl b/v2/cmd/wails/internal/commands/initialise/templates/generate/plain/main.go.tmpl index fc96ccb4e..329af5718 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/generate/plain/main.go.tmpl +++ b/v2/cmd/wails/internal/commands/initialise/templates/generate/plain/main.go.tmpl @@ -12,7 +12,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options/windows" ) -//go:embed frontend/src +//go:embed all:frontend/src var assets embed.FS //go:embed build/appicon.png diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/lit/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/plain/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/plain/main.tmpl.go index 96038b923..09d0b8ea3 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/plain/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/plain/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/src +//go:embed all:frontend/src var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/preact-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/preact-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/preact-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/preact-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/preact/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/preact/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/preact/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/preact/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/react/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/react/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/svelte/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/vanilla/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/vue-ts/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/vue-ts/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/vue-ts/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/vue-ts/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/v2/cmd/wails/internal/commands/initialise/templates/templates/vue/main.tmpl.go b/v2/cmd/wails/internal/commands/initialise/templates/templates/vue/main.tmpl.go index 90d993f90..e0f197dee 100644 --- a/v2/cmd/wails/internal/commands/initialise/templates/templates/vue/main.tmpl.go +++ b/v2/cmd/wails/internal/commands/initialise/templates/templates/vue/main.tmpl.go @@ -7,7 +7,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/docs/guides/dynamic-assets.mdx b/website/docs/guides/dynamic-assets.mdx index 62a807167..36b10133b 100644 --- a/website/docs/guides/dynamic-assets.mdx +++ b/website/docs/guides/dynamic-assets.mdx @@ -24,7 +24,7 @@ import ( "strings" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS type FileLoader struct { diff --git a/website/docs/guides/frameless.mdx b/website/docs/guides/frameless.mdx index fa34bc380..f60c2fd7f 100644 --- a/website/docs/guides/frameless.mdx +++ b/website/docs/guides/frameless.mdx @@ -41,7 +41,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/docs/guides/migrating.mdx b/website/docs/guides/migrating.mdx index b00859935..1fcdcc958 100644 --- a/website/docs/guides/migrating.mdx +++ b/website/docs/guides/migrating.mdx @@ -159,7 +159,7 @@ Example: An application has the following project layout. All final assets are p Those assets may be used by the application by simply creating an `embed.FS`: ```go title="Assets Example" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/docs/guides/troubleshooting.mdx b/website/docs/guides/troubleshooting.mdx index 8f768e0a1..6dc9f53ba 100644 --- a/website/docs/guides/troubleshooting.mdx +++ b/website/docs/guides/troubleshooting.mdx @@ -15,7 +15,7 @@ Check that your application includes the assets from the correct directory. In y something similar to the following code: ```go -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` diff --git a/website/docs/howdoesitwork.mdx b/website/docs/howdoesitwork.mdx index 62fafb685..87ce7b767 100644 --- a/website/docs/howdoesitwork.mdx +++ b/website/docs/howdoesitwork.mdx @@ -33,7 +33,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { @@ -95,7 +95,7 @@ there is no requirement on where in the `embed.FS` the files live. It is likely directory relative to your main application code, such as `frontend/dist`: ```go title="main.go" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` @@ -147,7 +147,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx index 77ad6d09e..a0e14211c 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx @@ -21,7 +21,7 @@ import ( "strings" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS type FileLoader struct { diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/frameless.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/frameless.mdx index c7ca5f6c3..3541c212f 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/frameless.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/frameless.mdx @@ -36,7 +36,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/migrating.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/migrating.mdx index c3b920e05..55b791e61 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/migrating.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/migrating.mdx @@ -145,7 +145,7 @@ Example: An application has the following project layout. All final assets are p Those assets may be used by the application by simply creating an `embed.FS`: ```go title="Assets Example" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx index b6a73efa5..23c9b7728 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -11,7 +11,7 @@ If your system is reporting that the `wails` command is missing, make sure you h Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code: ```go -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/ja/docusaurus-plugin-content-docs/current/howdoesitwork.mdx index 95db08724..efafbada9 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/howdoesitwork.mdx +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -27,7 +27,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { @@ -84,7 +84,7 @@ A full list of application options can be found in the [Options Reference](refer The `Assets` option is mandatory as you can't have a Wails application without frontend assets. Those assets can be any files you would expect to find in a web application - html, js, css, svg, png, etc. **There is no requirement to generate asset bundles** - plain files will do. When the application starts, it will attempt to load `index.html` from your assets and the frontend will essentially work as a browser from that point on. It is worth noting that there is no requirement on where in the `embed.FS` the files live. It is likely that the embed path uses a nested directory relative to your main application code, such as `frontend/dist`: ```go title="main.go" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` @@ -123,7 +123,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx index 4b68aef22..da2eea94c 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx @@ -21,7 +21,7 @@ import ( "strings" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS type FileLoader struct { diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/frameless.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/frameless.mdx index 4ae507f03..53ed4c3b1 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/frameless.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/frameless.mdx @@ -36,7 +36,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/migrating.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/migrating.mdx index a2f0c4a04..1ad2754a9 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/migrating.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/migrating.mdx @@ -145,7 +145,7 @@ Example: An application has the following project layout. All final assets are p Those assets may be used by the application by simply creating an `embed.FS`: ```go title="Assets Example" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx index 4de561c08..3e16071fd 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -11,7 +11,7 @@ If your system is reporting that the `wails` command is missing, make sure you h Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code: ```go -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/ko/docusaurus-plugin-content-docs/current/howdoesitwork.mdx index f59873eca..bb1046dfc 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/howdoesitwork.mdx +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -27,7 +27,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { @@ -84,7 +84,7 @@ A full list of application options can be found in the [Options Reference](refer The `Assets` option is mandatory as you can't have a Wails application without frontend assets. Those assets can be any files you would expect to find in a web application - html, js, css, svg, png, etc. **There is no requirement to generate asset bundles** - plain files will do. When the application starts, it will attempt to load `index.html` from your assets and the frontend will essentially work as a browser from that point on. It is worth noting that there is no requirement on where in the `embed.FS` the files live. It is likely that the embed path uses a nested directory relative to your main application code, such as `frontend/dist`: ```go title="main.go" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` @@ -123,7 +123,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx index 77ad6d09e..a0e14211c 100644 --- a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx @@ -21,7 +21,7 @@ import ( "strings" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS type FileLoader struct { diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx index c7ca5f6c3..3541c212f 100644 --- a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/frameless.mdx @@ -36,7 +36,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx index 2dff1a91b..71af1f4e4 100644 --- a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/migrating.mdx @@ -147,7 +147,7 @@ Example: An application has the following project layout. All final assets are p Those assets may be used by the application by simply creating an `embed.FS`: ```go title="Assets Example" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx index b6a73efa5..23c9b7728 100644 --- a/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -11,7 +11,7 @@ If your system is reporting that the `wails` command is missing, make sure you h Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code: ```go -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` diff --git a/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx index 0063b47a6..cd0d9b840 100644 --- a/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx +++ b/website/i18n/ru/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -27,7 +27,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { @@ -84,7 +84,7 @@ A full list of application options can be found in the [Options Reference](refer The `Assets` option is mandatory as you can't have a Wails application without frontend assets. Those assets can be any files you would expect to find in a web application - html, js, css, svg, png, etc. **There is no requirement to generate asset bundles** - plain files will do. When the application starts, it will attempt to load `index.html` from your assets and the frontend will essentially work as a browser from that point on. It is worth noting that there is no requirement on where in the `embed.FS` the files live. It is likely that the embed path uses a nested directory relative to your main application code, such as `frontend/dist`: ```go title="main.go" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` @@ -123,7 +123,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx index c28d70e9d..fedb2c0c9 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/dynamic-assets.mdx @@ -21,7 +21,7 @@ import ( "strings" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS type FileLoader struct { diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/frameless.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/frameless.mdx index 126a36c38..24385fb25 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/frameless.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/frameless.mdx @@ -36,7 +36,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/migrating.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/migrating.mdx index 426c6cba6..f7c00120d 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/migrating.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/migrating.mdx @@ -163,7 +163,7 @@ func (a *App) startup(ctx context.Context) { 应用程序可以通过简单地创建一个`embed.FS`来使用这些资源: ```go title="Assets Example" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx index bf338f32f..7cc6d3eba 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/guides/troubleshooting.mdx @@ -11,7 +11,7 @@ If your system is reporting that the `wails` command is missing, make sure you h 检查您的应用程序是否在正确目录中包含资源。 Check that your application includes the assets from the correct directory. In your `main.go` file, you will have something similar to the following code: ```go -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx index 297b4087b..ebd640bef 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/howdoesitwork.mdx @@ -27,7 +27,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() { @@ -84,7 +84,7 @@ func (b *App) Greet(name string) string { `Assets` 选项是必须的,因为您不能拥有没有前端资源的 Wails 应用程序。 这些资源可以是您希望在 Web 应用程序中找到的任何文件 - html、js、css、svg、png 等。 **不需要生成资源包** - 纯文件即可。 当应用程序启动时,它将尝试从您的资源中加载`index.html`,并且那时起前端基本上将作为浏览器工作。 值得注意的是`embed.FS`对文件所在的位置没有要求。 嵌入路径很可能使用了相对于您的主应用程序代码的嵌套目录,例如 `frontend/dist`: ```go title="main.go" -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS ``` @@ -123,7 +123,7 @@ import ( "github.com/wailsapp/wails/v2/pkg/options" ) -//go:embed frontend/dist +//go:embed all:frontend/dist var assets embed.FS func main() {