mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Merge commit 'dfb1895e4b82b2249d9baaed37ac7ae5e855a126'
This commit is contained in:
commit
9e4072ac23
3 changed files with 51 additions and 5 deletions
|
@ -499,6 +499,18 @@ The `build` configuration section contains global build-related configuration op
|
||||||
useResourceCacheWhen="fallback"
|
useResourceCacheWhen="fallback"
|
||||||
writeStats = false
|
writeStats = false
|
||||||
noJSConfigInAssets = false
|
noJSConfigInAssets = false
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/watching/hugo_stats\\.json"
|
||||||
|
target = "styles\\.css"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "(postcss|tailwind)\\.config\\.js"
|
||||||
|
target = "css"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/.*\\.(js|ts|jsx|tsx)"
|
||||||
|
target = "js"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/.*\\.(.*)$"
|
||||||
|
target = "$1"
|
||||||
{{< /code-toggle >}}
|
{{< /code-toggle >}}
|
||||||
|
|
||||||
|
|
||||||
|
@ -513,6 +525,40 @@ writeStats
|
||||||
noJSConfigInAssets
|
noJSConfigInAssets
|
||||||
: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](https://gohugo.io/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written.
|
: Turn off writing a `jsconfig.json` into your `/assets` folder with mapping of imports from running [js.Build](https://gohugo.io/hugo-pipes/js). This file is intended to help with intellisense/navigation inside code editors such as [VS Code](https://code.visualstudio.com/). Note that if you do not use `js.Build`, no file will be written.
|
||||||
|
|
||||||
|
cachebusters
|
||||||
|
: See [Configure Cache Busters](#configure-cache-busters)
|
||||||
|
|
||||||
|
## Configure Cache Busters
|
||||||
|
|
||||||
|
{{< new-in "0.112.0" >}}
|
||||||
|
|
||||||
|
The `build.cachebusters` configuration option was added to support development using Tailwind 3.x's JIT compiler where a `build` config may look like this:
|
||||||
|
|
||||||
|
{{< code-toggle file="hugo" >}}
|
||||||
|
[build]
|
||||||
|
writeStats = true
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/watching/hugo_stats\\.json"
|
||||||
|
target = "styles\\.css"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "(postcss|tailwind)\\.config\\.js"
|
||||||
|
target = "css"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/.*\\.(js|ts|jsx|tsx)"
|
||||||
|
target = "js"
|
||||||
|
[[build.cachebusters]]
|
||||||
|
source = "assets/.*\\.(.*)$"
|
||||||
|
target = "$1"
|
||||||
|
{{< /code-toggle >}}
|
||||||
|
|
||||||
|
Some key points in the above are `writeStats = true`, which writes a `hugo_stats.json` file on each build with HTML classes etc. that's used in the rendered output. Changes to this file will trigger a rebuild of the `styles.css` file. You also need to add `hugo_stats.json` to Hugo's server watcher. See [Hugo Starter Tailwind Basic](https://github.com/bep/hugo-starter-tailwind-basic) for a running example.
|
||||||
|
|
||||||
|
source
|
||||||
|
: A regexp matching file(s) relative to one of the virtual component directories in Hugo, typically `assets/...`.
|
||||||
|
|
||||||
|
target
|
||||||
|
: A regexp matching the keys in the resource cache that should be expired when `source` changes. You can use the matching regexp groups from `source` in the expression, e.g. `$1`.
|
||||||
|
|
||||||
## Configure Server
|
## Configure Server
|
||||||
|
|
||||||
This is only relevant when running `hugo server`, and it allows to set HTTP headers during development, which allows you to test out your Content Security Policy and similar. The configuration format matches [Netlify's](https://docs.netlify.com/routing/headers/#syntax-for-the-netlify-configuration-file) with slightly more powerful [Glob matching](https://github.com/gobwas/glob):
|
This is only relevant when running `hugo server`, and it allows to set HTTP headers during development, which allows you to test out your Content Security Policy and similar. The configuration format matches [Netlify's](https://docs.netlify.com/routing/headers/#syntax-for-the-netlify-configuration-file) with slightly more powerful [Glob matching](https://github.com/gobwas/glob):
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
To build Hugo from source you must:
|
To build Hugo from source you must:
|
||||||
|
|
||||||
1. Install [Git]
|
1. Install [Git]
|
||||||
1. Install [Go] version 1.18 or later
|
1. Install [Go] version 1.19 or later
|
||||||
1. Update your PATH environment variable as described in the [Go documentation]
|
1. Update your PATH environment variable as described in the [Go documentation]
|
||||||
|
|
||||||
> The install directory is controlled by the GOPATH and GOBIN environment variables. If GOBIN is set, binaries are installed to that directory. If GOPATH is set, binaries are installed to the bin subdirectory of the first directory in the GOPATH list. Otherwise, binaries are installed to the bin subdirectory of the default GOPATH ($HOME/go or %USERPROFILE%\go).
|
> The install directory is controlled by the GOPATH and GOBIN environment variables. If GOBIN is set, binaries are installed to that directory. If GOPATH is set, binaries are installed to the bin subdirectory of the first directory in the GOPATH list. Otherwise, binaries are installed to the bin subdirectory of the default GOPATH ($HOME/go or %USERPROFILE%\go).
|
||||||
|
|
|
@ -3,7 +3,7 @@ publish = "public"
|
||||||
command = "hugo --gc --minify"
|
command = "hugo --gc --minify"
|
||||||
|
|
||||||
[context.production.environment]
|
[context.production.environment]
|
||||||
HUGO_VERSION = "0.112.3"
|
HUGO_VERSION = "0.112.5"
|
||||||
HUGO_ENV = "production"
|
HUGO_ENV = "production"
|
||||||
HUGO_ENABLEGITINFO = "true"
|
HUGO_ENABLEGITINFO = "true"
|
||||||
|
|
||||||
|
@ -11,20 +11,20 @@ HUGO_ENABLEGITINFO = "true"
|
||||||
command = "hugo --gc --minify --enableGitInfo"
|
command = "hugo --gc --minify --enableGitInfo"
|
||||||
|
|
||||||
[context.split1.environment]
|
[context.split1.environment]
|
||||||
HUGO_VERSION = "0.112.3"
|
HUGO_VERSION = "0.112.5"
|
||||||
HUGO_ENV = "production"
|
HUGO_ENV = "production"
|
||||||
|
|
||||||
[context.deploy-preview]
|
[context.deploy-preview]
|
||||||
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
command = "hugo --gc --minify --buildFuture -b $DEPLOY_PRIME_URL"
|
||||||
|
|
||||||
[context.deploy-preview.environment]
|
[context.deploy-preview.environment]
|
||||||
HUGO_VERSION = "0.112.3"
|
HUGO_VERSION = "0.112.5"
|
||||||
|
|
||||||
[context.branch-deploy]
|
[context.branch-deploy]
|
||||||
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
command = "hugo --gc --minify -b $DEPLOY_PRIME_URL"
|
||||||
|
|
||||||
[context.branch-deploy.environment]
|
[context.branch-deploy.environment]
|
||||||
HUGO_VERSION = "0.112.3"
|
HUGO_VERSION = "0.112.5"
|
||||||
|
|
||||||
[context.next.environment]
|
[context.next.environment]
|
||||||
HUGO_ENABLEGITINFO = "true"
|
HUGO_ENABLEGITINFO = "true"
|
||||||
|
|
Loading…
Reference in a new issue