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 9c15b874..1d2502b5 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 90d993f9..e0f197de 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 fc96ccb4..329af571 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 96038b92..09d0b8ea 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 90d993f9..e0f197de 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 62a80716..36b10133 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 fa34bc38..f60c2fd7 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 b0085993..1fcdcc95 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 8f768e0a..6dc9f53b 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 62fafb68..87ce7b76 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 77ad6d09..a0e14211 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 c7ca5f6c..3541c212 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 c3b920e0..55b791e6 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 b6a73efa..23c9b772 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 95db0872..efafbada 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 4b68aef2..da2eea94 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 4ae507f0..53ed4c3b 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 a2f0c4a0..1ad2754a 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 4de561c0..3e16071f 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 f59873ec..bb1046df 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 77ad6d09..a0e14211 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 c7ca5f6c..3541c212 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 2dff1a91..71af1f4e 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 b6a73efa..23c9b772 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 0063b47a..cd0d9b84 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 c28d70e9..fedb2c0c 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 126a36c3..24385fb2 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 426c6cba..f7c00120 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 bf338f32..7cc6d3eb 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 297b4087..ebd640be 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() {