I use node-sass to compile all my Sass files to a master.css. This works well but now I want to add prefixes. I would like to use only the npm, no Gulp or Grunt.
Here my
Sass With Node Js (with Autoprefixer)
npm i -D autoprefixer clean-css-cli node-sass postcss-cli
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"autoprefixer": "^9.5.1",
"browserslist": "^4.5.4",
"clean-css-cli": "^4.3.0",
"node-sass": "^4.11.0",
"postcss": "^7.0.14",
"postcss-cli": "^6.1.2"
},
"devDependencies": {},
"scripts": {
"clean": "rimraf scss",
"compile": "node-sass --output-style=expanded --source-map=true css/scss/main.scss css/scss/main.css",
"prefix": "postcss css/scss/main.css --use=autoprefixer --map=false --output=css/scss/main.css",
"minify": "cleancss --level=1 --source-map --source-map-inline-sources --output css/scss/main.min.css css/scss/main.css",
"dev": "npm run compile -- --watch",
"build": "npm run clean && npm run compile && npm run prefix && npm run minify",
"test": "echo \"Error: no test specified\" && exit 1"
},
"browserslist": [
"last 4 version"
],
"author": "",
"license": "ISC"
}
Terminal command to build: npm run build