npm with node-sass and autoprefixer

前端 未结 3 1377
囚心锁ツ
囚心锁ツ 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条回答
  •  难免孤独
    2021-01-31 05:05

    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

提交回复
热议问题