Merge commit '87de22d7464e239c775fbd48ebce1665d5b1e80d'

This commit is contained in:
Bjørn Erik Pedersen
2023-07-29 11:17:28 +02:00
177 changed files with 1623 additions and 1556 deletions

View File

@@ -5,9 +5,9 @@ categories: [asset management]
keywords: []
menu:
docs:
parent: pipes
weight: 39
weight: 39
parent: hugo-pipes
weight: 50
weight: 50
signature: ["resources.PostProcess RESOURCE"]
---
@@ -36,11 +36,17 @@ There are several ways to set up CSS purging with PostCSS in Hugo. If you have a
The below configuration will write a `hugo_stats.json` file to the project root as part of the build. If you're only using this for the production build, you should consider placing it below [config/production](/getting-started/configuration/#configuration-directory).
<!-- TODO (jmm) writeStats => build.buildStats -->
{{< code-toggle file="hugo" >}}
[build]
writeStats = true
[build.buildStats]
enable = true
{{< /code-toggle >}}
See the [configure build] documentation for details and options.
[configure build]: /getting-started/configuration/#configure-build
`postcss.config.js`
```js
@@ -71,7 +77,7 @@ Note that in the example above, the "CSS purge step" will only be applied to the
```
## Hugo Environment variables available in PostCSS
## Hugo environment variables available in PostCSS
These are the environment variables Hugo passes down to PostCSS (and Babel), which allows you do do `process.env.HUGO_ENVIRONMENT === 'production' ? [autoprefixer] : []` and similar:
@@ -83,7 +89,7 @@ HUGO_ENVIRONMENT (and the alias HUGO_ENV)
HUGO_PUBLISHDIR
: {{< new-in "0.109.0" >}} The absolute path to the publish directory (the `public` directory). Note that the value will always point to a directory on disk even when running `hugo server` in memory mode. If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:
```
```text
hugo server --renderToDisk
hugo server --renderStaticToDisk
```