几个月来,我一直试图让 Parcel 添加供应商前缀(这就像现在不可能实现的梦想)。有人告诉我 Parcel 2 会正确执行此操作,但我仍然在生成的 css 文件中看到没有供应商前缀。其他一切似乎都工作得很好。它工作了一次,然后再也没有,而且在它工作了一次之后我没有改变任何东西。
必须有办法做到这一点!我猜这个问题与 postcss-modules 有关,但是如何呢?
我的 package.json:
{
"name": "static-boilerplate",
"version": "1.0.0",
"description": "Boilerplate for building static websites with Parcel",
"main": "index.html",
"scripts": {
"start": "parcel serve src/index.html -p 3000 --open",
"prebuild": "rm -rf dist/*",
"build": "parcel build src/index.html"
},
"keywords": [
"parcel",
"boilerplate",
"static",
"website"
],
"author": "Tom Tillistrand repo",
"license": "ISC",
"devDependencies": {
"@babel/eslint-parser": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.11.0",
"@babel/runtime-corejs2": "^7.13.10",
"@parcel/transformer-sass": "^2.0.0-nightly.621",
"autoprefixer": "^9.8.6",
"css-mqpacker": "^7.0.0",
"parcel": "^2.0.0-beta.1",
"postcss-custom-properties": "^11.0.0",
"postcss-modules": "^4.0.0",
"sass": "^1.26.10"
}
}
我的 .postcssrc 文件:(我不确定是否使用“模块:true”,但目前这两种方法都不起作用)
{
"plugins": {
"autoprefixer": {
"grid": true
},
"postcss-custom-properties": true,
"css-mqpacker": true
}
}
我的 .babelrc 文件:
{
"plugins": [
[
"@babel/plugin-transform-runtime",
{
"corejs": 2,
"regenerator": true
}
]
]
}