Update postcss npm instructions (#1931)

This commit is contained in:
Joe Mooring 2022-12-13 17:24:47 -08:00 committed by GitHub
parent 63020094ad
commit 375d75c013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,6 @@
--- ---
title: PostCSS title: PostCSS
description: Hugo Pipes can process CSS files with PostCSS. description: Hugo Pipes can process CSS files with PostCSS.
date: 2018-07-14
publishdate: 2018-07-14
categories: [asset management] categories: [asset management]
keywords: [] keywords: []
menu: menu:
@ -10,7 +8,6 @@ menu:
parent: "pipes" parent: "pipes"
weight: 40 weight: 40
weight: 40 weight: 40
sections_weight: 40
--- ---
Any asset file can be processed using `resources.PostCSS` which takes for argument the resource object and a slice of options listed below. Any asset file can be processed using `resources.PostCSS` which takes for argument the resource object and a slice of options listed below.
@ -22,11 +19,11 @@ The resource will be processed using the project's or theme's own `postcss.confi
{{ $style := $css | resources.PostCSS }} {{ $style := $css | resources.PostCSS }}
``` ```
{{% note %}} You must install the required Node.js packages to use the PostCSS feature. For example, to use the `autoprefixer` package, run these commands from the root of your project:
Hugo Pipe's PostCSS requires the `postcss-cli` JavaScript package to be installed in the environment (`npm install -g postcss postcss-cli`) along with any PostCSS plugin(s) used (e.g., `npm install -g autoprefixer`).
If you are using the Hugo Snap package, PostCSS and plugin(s) need to be installed locally within your Hugo site directory, e.g., `npm install postcss-cli` without the `-g` flag. ```text
{{% /note %}} npm install -D postcss postcss-cli autoprefixer
```
### Options ### Options