summaryrefslogtreecommitdiffstats
path: root/docs/content
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-26 10:06:04 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-02-27 11:47:24 +0100
commitb66d38c41939252649365822d9edb10cf5990617 (patch)
treea58b900180aff71edc36ed040f7e184f44cfc724 /docs/content
parent05a74eaec0d944a4b29445c878a431cd6ae12277 (diff)
resources: Add basic @import support to resources.PostCSS
This commit also makes the HUGO_ENVIRONMENT environment variable available to Node. Fixes #6957 Fixes #6961
Diffstat (limited to 'docs/content')
-rwxr-xr-xdocs/content/en/hugo-pipes/postcss.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/content/en/hugo-pipes/postcss.md b/docs/content/en/hugo-pipes/postcss.md
index a0a673798..a7ba097fa 100755
--- a/docs/content/en/hugo-pipes/postcss.md
+++ b/docs/content/en/hugo-pipes/postcss.md
@@ -39,6 +39,12 @@ config [string]
noMap [bool]
: Default is `true`. Disable the default inline sourcemaps
+inlineImports [bool] {{< new-in "0.66.0" >}}
+: Default is `false`. Enable inlining of @import statements. It does so recursively, but will only import a file once.
+URL imports (e.g. `@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');`) and imports with media queries will be ignored.
+Note that this import routine does not care about the CSS spec, so you can have @import anywhere in the file.
+Hugo will look for imports relative to the module mount and will respect theme overrides.
+
_If no configuration file is used:_
use [string]
@@ -55,4 +61,21 @@ syntax [string]
```go-html-template
{{ $style := resources.Get "css/main.css" | resources.PostCSS (dict "config" "customPostCSS.js" "noMap" true) }}
+```
+
+## Check Hugo Environment from postcss.config.js
+
+{{< new-in "0.66.0" >}}
+
+The current Hugo environment name (set by `--environment` or in config or OS environment) is available in the Node context, which allows constructs like this:
+
+```js
+module.exports = {
+ plugins: [
+ require('autoprefixer'),
+ ...process.env.HUGO_ENVIRONMENT === 'production'
+ ? [purgecss]
+ : []
+ ]
+}
``` \ No newline at end of file