CSS/SCSS Resources
As of Hugo version 0.43, we can use Hugo’s asset pipelines to process CSS. This means we can use SASS/SCSS, combine files into one stylesheet, cachebust our stylesheets automatically, and minify CSS without installing any additional build tools. This means we really only have to run hugo
or hugo server
to process these resources.
{{ $s := resources.Get “scss/style.scss” | toCSS | postCSS | minify }}
postCSS needs to be installed first:
- In root, run
npm install postcss-cli
npm install autoprefixer
- add postcss.config.js to root. Example
- Add package.json to root. Example
- Add
/node_modules
to .gitignore
Read more about asset processing with Hugo.