73a01565c Remove comment shortcode documentation 0ca7ccd30 Replace usage of comment shortcode with HTML comments fe10d9899 Remove expired new-in labels 11e89dfcb [editorial] Link to proper render-hook page in relref.md 11a581c2f netlify: Hugo 0.142.0 1a4fcf7f7 Miscellaneous edits 2c7a3165f Markdown linting and cleanup 69d7a781b Replace links to glossary terms with custom render hook syntax 441752d2d Refactor glossary lookup portion of link render hook 80109a14f Fix glossary term linking for plural form cd95f0f34 Update link render hook to support glossary links 53eadb430 Remove the glossary template 1d40a7f3b Improve transform.ToMath examples 586970df2 Misc edits 6a06a8de7 Add glossary link shortcode 4171c0eb7 Improve description of masking with non-transparent images 41c8feb64 Fix example of image.Mask filter 704a81656 Add alignx option to images.Text usage example 7c03eb0cc Clarify context in example of using the try statement 56d9c9b71 Refactor glossary of terms 042a6846b Add expiry dates to deprecated methods pages 365ab345f Remove services key from instagram shortcode page b7fe31e07 Reorder options list for images.Text filter 8051ff818 Format directory names, file names, and file paths as code d09a14623 Update version refs for Hugo and Dart Sass 3bb006974 Add NODE_VERSION to Netlify config examples 3a0f2531e Fix typo 7e3198eaf Fix typo cf56452a3 Fix typo a9f51d13e Fix typo 82bfdd8c3 Fix typo a5c41a053 Fix typo abcfed7a5 Fix typo 8c1debf3a Remove outdated new-in badges 809ddf9ef Update theme 63867d56f Use warnf instead of errorf in try-catch example dee3e5f09 Update theme 9791f7057 Remove TODO from comment shortcode examples a346ca1fd Elevate embedded shortcode documentation to its own section 8fa19b50f hugoreleaser.toml => hugoreleaser.yaml 575d60345 Update docs for v0.141.0 a0a442d62 netlify: Hugo 0.141.0 6667cbcd8 Merge commit '81a7b6390036138356773c87a886679c81c524e1' f36fc013e docs: Regen CLI docs 365a47ded tpl/images: Change signature of images.QR to images.QR TEXT OPTIONS ae8f8af0a images.Text: Add "alignx" option for horizontal alignment 8f45ccca6 docs: Regen CLI docs f0e6304f4 Merge commit 'e9fbadacc3f09191e2e19f112a49777eeb8df06c' cb9bec2b2 tpl/images: Add images.QR function git-subtree-dir: docs git-subtree-split: 73a01565c5ba0774d65aa6f2384c44804fefa37d
3.1 KiB
title | description | categories | keywords | action | toc | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
css.TailwindCSS | Processes the given resource with the Tailwind CSS CLI. |
|
true |
{{< new-in 0.128.0 >}}
{{% todo %}}remove this admonition when feature is stable.{{% /todo %}}
{{% note %}} This is an experimental feature pending the release of TailwindCSS v4.0.
The functionality, configuration requirements, and documentation are subject to change at any time and may be not compatible with prior releases. {{% /note %}}
Prerequisites
To use this function you must install the Tailwind CSS CLI v4.0 or later. You may install the CLI as an npm package or as a standalone executable. See the Tailwind CSS documentation for details.
{{% note %}} Prior to the release of Tailwind CSS v4.0 you must install v4.0.0-alpha.26 or later.
npm install --save-dev tailwindcss@next @tailwindcss/cli@next
{{% /note %}}
Options
- minify
- (
bool
) Whether to optimize and minify the output. Default isfalse
. - optimize
- (
bool
) Whether to optimize the output without minifying. Default isfalse
. - 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 isfalse
. - skipInlineImportsNotFound
- (
bool
) WheninlineImports
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 isfalse
.
Example
Define a cache buster in your site configuration:
{{< code-toggle file=hugo >}} build.cachebusters source = 'layouts/.*' target = 'css' {{< /code-toggle >}}
Process the resource:
{{ with resources.Get "css/main.css" }}
{{ $opts := dict "minify" true }}
{{ with . | css.TailwindCSS $opts }}
{{ if hugo.IsDevelopment }}
<link rel="stylesheet" href="{{ .RelPermalink }}">
{{ else }}
{{ with . | fingerprint }}
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
{{ end }}
{{ end }}
{{ end }}
{{ end }}
The example above publishes the minified CSS file to public/css/main.css
.
See this repository for more information about the integration with Tailwind CSS v4.0.