Budi
Budi

Reputation: 688

NPM Script for "node-sass" and "postcss" to autoprefix

I need to compile my scss to css files with autoprefixing the attributes. My npm script looks like this:

{
  "scripts": {
    "build:css": "node-sass --output-style 'compressed' src/scss/ -o public_html/css/map/ && postcss --use autoprefixer public_html/css/map/ -d public_html/css/",
    "watch:css": "node-sass --watch --recursive --output-style 'compressed' src/scss/ -o public_html/css/"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.3.7",
    "node-sass": "^4.5.0",
    "postcss": "^6.0.13",
    "postcss-cli": "^4.1.1"
  }
}

But I get a error message:

Plugin Error: Cannot find module 'autoprefixer'

At last i think that my code is dirty. I try to generate with node-sass the css files, and place them on filetree in "map" directory. Then i try to grab them with postcss and copy the autoprefixed css files in the css folder. Is there any cleaner way without creating the files in the map directory?

Upvotes: 1

Views: 1251

Answers (1)

Maurice van Cooten
Maurice van Cooten

Reputation: 42

You need to install the npm module: autoprefixer

npm install autoprefixer --save-dev

Upvotes: 1

Related Questions