content: Consolidate configuration documentation

This commit is contained in:
Joe Mooring authored and GitHub committed 2025-03-05 04:50:06 -08:00
1 parent 727ef6f665
commit b6cae5cbc6
911 files changed
+10902 -11171

No files matched your search

+27 -22
View File
@@ -3,14 +3,14 @@ title: css.PostCSS
description: Processes the given resource with PostCSS using any PostCSS plugin.
categories: []
keywords: []
action:
aliases: [postCSS]
related:
- functions/css/Sass
- functions/css/TailwindCSS
returnType: resource.Resource
signatures: ['css.PostCSS [OPTIONS] RESOURCE']
toc: true
params:
functions_and_methods:
aliases: [postCSS]
related:
- functions/css/Sass
- functions/css/TailwindCSS
returnType: resource.Resource
signatures: ['css.PostCSS [OPTIONS] RESOURCE']
---
{{< new-in 0.128.0 />}}
@@ -27,20 +27,23 @@ Follow the steps below to transform CSS using any of the available [PostCSS plug
[postcss plugins]: https://postcss.org/docs/postcss-plugins
Step 1
: Install [Node.js].
### Step 1
Install [Node.js].
[node.js]: https://nodejs.org/en/download
Step 2
: Install the required Node.js packages in the root of your project. For example, to add vendor prefixes to your CSS rules:
### Step 2
Install the required Node.js packages in the root of your project. For example, to add vendor prefixes to your CSS rules:
```sh
npm i -D postcss postcss-cli autoprefixer
```
Step 3
: Create a PostCSS configuration file in the root of your project.
### Step 3
Create a PostCSS configuration file in the root of your project.
{{< code file=postcss.config.js >}}
module.exports = {
@@ -51,14 +54,16 @@ module.exports = {
{{< /code >}}
{{< note >}}
{{% include "functions/resources/_common/postcss-windows-warning.md" %}}
{{% include "/_common/functions/postcss-windows-warning.md" %}}
{{< /note >}}
Step 4
: Place your CSS file within the `assets/css` directory.
### Step 4
Step 5
: Process the resource with PostCSS:
Place your CSS file within the `assets/css` directory.
### Step 5
Process the resource with PostCSS:
```go-html-template
{{ with resources.Get "css/main.css" | postCSS }}
@@ -74,13 +79,13 @@ config
: (`string`) The directory that contains the PostCSS configuration file. Default is the root of the project directory.
noMap
: (`bool`) Default is `false`. If `true`, disables inline sourcemaps.
: (`bool`) Whether to disable inline source maps. Default is `false`.
inlineImports
: (`bool`) 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.
: (`bool`) Whether to 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. Default is `false`.
skipInlineImportsNotFound
: (`bool`) Default is `false`. Before Hugo 0.99.0 when `inlineImports` was enabled and we failed to resolve an import, we logged it as a warning. We now fail the build. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set `skipInlineImportsNotFound` to true.
: (`bool`) Whether to allow the build process to continue despite unresolved import statements, preserving the original import declarations. If you have regular CSS imports in your CSS that you want to preserve, you can either use imports with URL or media queries (Hugo does not try to resolve those) or set this option to `true`. Default is `false`."
```go-html-template
{{ $opts := dict "config" "config-directory" "noMap" true }}
+17 -17
View File
@@ -3,16 +3,16 @@ title: css.Sass
description: Transpiles Sass to CSS.
categories: []
keywords: []
action:
aliases: [toCSS]
related:
- functions/resources/Fingerprint
- functions/resources/Minify
- functions/css/PostCSS
- functions/resources/PostProcess
returnType: resource.Resource
signatures: ['css.Sass [OPTIONS] RESOURCE']
toc: true
params:
functions_and_methods:
aliases: [toCSS]
related:
- functions/resources/Fingerprint
- functions/resources/Minify
- functions/css/PostCSS
- functions/resources/PostProcess
returnType: resource.Resource
signatures: ['css.Sass [OPTIONS] RESOURCE']
---
{{< new-in 0.128.0 />}}
@@ -70,10 +70,10 @@ precision
: (`int`) Precision of floating point math. Not applicable to Dart Sass.
enableSourceMap
: (`bool`) If `true`, generates a source map.
: (`bool`) Whether to generate a source map. Default is `false`.
sourceMapIncludeSources
: (`bool`) If `true`, embeds sources in the generated source map. Not applicable to LibSass.
: (`bool`) Whether to embed sources in the generated source map. Not applicable to LibSass. Default is `false`.
includePaths
: (`slice`) A slice of paths, relative to the project root, that the transpiler will use when resolving `@use` and `@import` statements.
@@ -149,8 +149,8 @@ To install Dart Sass for your builds on GitLab Pages, the `.gitlab-ci.yml` file
```yaml
variables:
HUGO_VERSION: 0.141.0
DART_SASS_VERSION: 1.83.4
HUGO_VERSION: 0.144.2
DART_SASS_VERSION: 1.85.0
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
@@ -183,8 +183,8 @@ To install Dart Sass for your builds on Netlify, the `netlify.toml` file should
```toml
[build.environment]
HUGO_VERSION = "0.141.0"
DART_SASS_VERSION = "1.83.4"
HUGO_VERSION = "0.144.2"
DART_SASS_VERSION = "1.85.0"
NODE_VERSION = "22"
TZ = "America/Los_Angeles"
@@ -234,7 +234,7 @@ If you build Hugo from source and run `mage test -v`, the test will fail if you
[libsass]: https://sass-lang.com/libsass
[prebuilt binaries]: https://github.com/sass/dart-sass/releases/latest
[scoop.sh]: https://scoop.sh/#/apps?q=sass
[site configuration]: /getting-started/configuration/#configure-build
[site configuration]: /configuration/build/
[snap package]: /installation/linux/#snap
[snapcraft.io]: https://snapcraft.io/dart-sass
[starter workflow]: https://github.com/actions/starter-workflows/blob/main/pages/hugo.yml
+17 -18
View File
@@ -3,20 +3,20 @@ title: css.TailwindCSS
description: Processes the given resource with the Tailwind CSS CLI.
categories: []
keywords: []
action:
aliases: []
related:
- functions/resources/Fingerprint
- functions/resources/Minify
- functions/css/PostCSS
returnType: resource.Resource
signatures: ['css.TailwindCSS [OPTIONS] RESOURCE']
toc: true
params:
functions_and_methods:
aliases: []
related:
- functions/resources/Fingerprint
- functions/resources/Minify
- functions/css/PostCSS
returnType: resource.Resource
signatures: ['css.TailwindCSS [OPTIONS] RESOURCE']
---
{{< new-in 0.128.0 />}}
Use the `css.TailwindCSS` function to process your Tailwind CSS files. This function uses the Tailwind CSS CLI to:
Use the `css.TailwindCSS` function to process your Tailwind CSS files. This function uses the Tailwind CSS CLI to:
1. Scan your templates for Tailwind CSS utility class usage.
1. Compile those utility classes into standard CSS.
@@ -24,7 +24,7 @@ Use the `css.TailwindCSS` function to process your Tailwind CSS files. This fun
## Setup
###### Step 1
### Step 1
Install the Tailwind CSS CLI v4.0 or later:
@@ -36,7 +36,7 @@ The TailwindCSS CLI is also available as a [standalone executable] if you want t
[standalone executable]: https://github.com/tailwindlabs/tailwindcss/releases/latest
###### Step 2
### Step 2
Add this to your site configuration:
@@ -58,8 +58,7 @@ source = "(postcss|tailwind)\\.config\\.js"
target = "css"
{{< /code-toggle >}}
###### Step 3
### Step 3
Create a CSS entry file:
@@ -70,7 +69,7 @@ Create a CSS entry file:
Tailwind CSS respects `.gitignore` files. This means that if `hugo_stats.json` is listed in your `.gitignore` file, Tailwind CSS will ignore it. To make `hugo_stats.json` available to Tailwind CSS you must explicitly source it as shown in the example above.
###### Step 4
### Step 4
Create a partial template to process the CSS with the Tailwind CSS CLI:
@@ -94,7 +93,7 @@ Create a partial template to process the CSS with the Tailwind CSS CLI:
{{ end }}
{{< /code >}}
###### Step 5
### Step 5
Call the partial template from your base template:
@@ -106,7 +105,7 @@ Call the partial template from your base template:
<head>
{{< /code >}}
###### Step 6
### Step 6
Optionally create a `tailwind.config.js` file in the root of your project as shown below. This is necessary if you use the [Tailwind CSS IntelliSense
extension] for Visual Studio Code.
@@ -137,4 +136,4 @@ inlineImports
: (`bool`) Whether to enable inlining of `@import` statements. Inlining is performed recursively, but currently once only per file. It is not possible to import the same file in different scopes (root, media query, etc.). Note that this import routine does not care about the CSS specification, so you can have `@import` statements anywhere in the file. Default is `false`.
skipInlineImportsNotFound
: (`bool`) When `inlineImports` is enabled, we fail the build if an import cannot be resolved. Enable this option to allow the build to continue and leave the import statement in place. Note that the inline importer does not process URL location or imports with media queries, so those will be left as-is even without enabling this option. Default is `false`.
: (`bool`) Whether to allow the build process to continue despite unresolved import statements, preserving the original import declarations. It is important to note that the inline importer does not process URL-based imports or those with media queries, and these will remain unaltered even when this option is disabled. Default is `false`.
+1 -6
View File
@@ -1,12 +1,7 @@
---
title: CSS functions
linkTitle: css
description: Template functions to work with CSS and Sass files.
description: Use these functions to work with CSS and Sass files.
categories: []
keywords: []
menu:
docs:
parent: functions
---
Use these functions to work with CSS and Sass files.