Hi,
i’m new french user of hugo.
I will create a new theme with bulma framework with npm option.
Bulma work correctly but i wish use purgecss because bulma css folder is 194ko ans i wish reduce this for optimisation.
i installing postcss, autoprefixer ans purgecss.
I have a probleme when a use hugo server commande, i have this message but i don’t understand this information :
Building sites …
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
TypeError: Cannot read property ‘names’ of undefined
at Object.mergeExtractorSelectors (/Users/tintin/mongit/bulma/node_modules/purgecss/lib/purgecss.js:1:3177)
at /Users/tintin/mongit/bulma/node_modules/postcss-purgecss/lib/postcss-purgecss.js:1:649
ERROR 2020/02/29 17:25:18 Transformation failed: exit status 1
Built in 1788 ms
Error: Error building site: logged 1 error(s)
In my postcss.config.js(in theme forlder) i have this :
const purgecss = require('postcss-purgecss')
const autoprefixer = require('autoprefixer')
module.exports = {
plugins: [
purgecss({
content: [
'layouts/**/*.html'
]
}),
autoprefixer({
browsers: [
''
]
})
]
}
in my package.json i have this informations
{
"name": "bulmasite",
"version": "1.0.0",
"description": "theme cree avec bulma",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Valentin",
"license": "MIT",
"dependencies": {
"autoprefixer": "^9.7.4",
"bulma": "^0.8.0",
"postcss-cli": "^7.1.0",
"postcss-purgecss": "^2.0.3",
"purgecss": "^2.1.0"
}
}
in hy head i use this code
<head>
{{ $style := resources.Get "css/main.scss" | toCSS | postCSS (dict "config" (.Scratch.Get "config") "noMap" true) | minify | fingerprint }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}" media="screen" async>
</head>
Could you help me please
Best regards