summaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-01 10:51:24 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-01 10:51:24 +0200
commit9e4072ac237b14bc8beba7bfab83720a23098a1e (patch)
tree39c52f87a998fb08e6797470688ef4213b16a6fa /docs/content
parent0ef29528469975bf2251dea78699dbeac55d02ae (diff)
parentdfb1895e4b82b2249d9baaed37ac7ae5e855a126 (diff)
Diffstat (limited to 'docs/content')
-rw-r--r--docs/content/en/getting-started/configuration.md46
-rw-r--r--docs/content/en/installation/common/05-build-from-source.md2
2 files changed, 47 insertions, 1 deletions
diff --git a/docs/content/en/getting-started/configuration.md b/docs/content/en/getting-started/configuration.md
index 53b444bb6..2ab9e6a33 100644
--- a/docs/content/en/getting-started/configuration.md
+++ b/docs/content/en/getting-started/configuration.md
@@ -499,6 +499,18 @@ The `build` configuration section contains global build-related configuration op
useResourceCacheWhen="fallback"
writeStats = 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 >}}
@@ -513,6 +525,40 @@ writeStats
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.
+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
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):
diff --git a/docs/content/en/installation/common/05-build-from-source.md b/docs/content/en/installation/common/05-build-from-source.md
index a135de9fd..c0bd85515 100644
--- a/docs/content/en/installation/common/05-build-from-source.md
+++ b/docs/content/en/installation/common/05-build-from-source.md
@@ -3,7 +3,7 @@
To build Hugo from source you must:
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]
> 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).