npm with node-sass and autoprefixer

前端 未结 3 1378
囚心锁ツ
囚心锁ツ 2021-01-31 04:59

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

3条回答
  •  旧时难觅i
    2021-01-31 05:20

    Let's say we have styles.sass file in sass directory. I've used something like this (my package.json):

    {
     "scripts": {
        "c":"node-sass sass/styles.sass -o .|postcss styles.css -u autoprefixer -r",
        "w":"watch 'npm run c' sass"
     }
    }   
    

    terminal command: npm run w. At this point each saving of styles.sass file will produce compiled and prefixed styles.css file automatically. I have postcss-cli, node-sass and watch packages installed globally.

提交回复
热议问题