【问题标题】:npm autoprefixer are not working in my front-end markup projectnpm autoprefixer 在我的前端标记项目中不起作用
【发布时间】:2022-07-21 14:09:55
【问题描述】:

我正在尝试在我的前端项目中使用 autoprefixer,但它没有按预期工作。

{
  "name": "frontend",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "",
  "author": "",
  "scripts": {
    "watch": "sass scss/app.scss styles/app.css -w",
    "prefix:css": "postcss --use autoprefixer -b 'last 10 versions' styles/app.css -o styles/app.min.css",
    "build": "sass scss/app.scss styles/app.min.css --style=compressed"
  },
  "license": "MIT",
  "dependencies": {
    "sass": "^1.52.3"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.7",
    "postcss": "^8.4.14",
    "postcss-cli": "^10.0.0"
  }
}

【问题讨论】:

    标签: npm cross-browser web-frontend autoprefixer


    【解决方案1】:

    我在互联网上找到了解决方案。 Source code of this solution

    在 JSON 中替换这行代码:

    "browserslist": ["last 10 versions"],
    "prefix:css": "postcss styles/app.css --use=autoprefixer --map=false --output=styles/app.prefix.css",
    

    详情:

    {
      "name": "frontend",
      "version": "1.0.0",
      "main": "index.js",
      "repository": "",
      "author": "",
      "browserslist": ["last 10 versions"],
      "scripts": {
        "watch": "sass scss/app.scss styles/app.css -w",
        "prefix:css": "postcss styles/app.css --use=autoprefixer --map=false --output=styles/app.prefix.css",
        "build": "sass scss/app.scss styles/app.min.css --style=compressed"
      },
      "license": "MIT",
      "dependencies": {
        "sass": "^1.52.3"
      },
      "devDependencies": {
        "autoprefixer": "^10.4.7",
        "postcss": "^8.4.14",
        "postcss-cli": "^10.0.0"
      }
    }
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 2016-05-05
      • 2019-05-12
      • 2019-12-15
      • 2020-01-31
      • 1970-01-01
      • 2018-10-30
      相关资源
      最近更新 更多