Cannot find module autoprefixer in NPM scripts

前端 未结 1 1211
夕颜
夕颜 2021-01-22 17:15

Under windows 10 and npm version 6.9.0, I cannot get the following script to work:

\"build:css\": \"postcss --use autopr         


        
相关标签:
1条回答
  • 2021-01-22 17:57
    1. Create a new file named postcss.config.js that contains the following content:

      module.exports = {
        plugins: {
          autoprefixer: {
            browsers: ['last 10 versions']
          }
        }
      };
      

      Save the newly created postcss.config.js file in the root of your project directory, i.e. save it in the same directory where package.json resides.

    2. Change the npm script named build:css in your package.json to the following:

      ...
      "scripts": {
        ...
        "build:css": "postcss ./static/css/main.css -o ./static/css/main-prefixed.css"
      },
      ...
      
    0 讨论(0)
提交回复
热议问题