停止 cssnano v4 向命名网格区域添加引号
Stop cssnano v4 from adding quotes to named grid-areas
cssnano v4 将命名的网格区域变成带引号的字符串而不是 custom-identifiers,例如:
/* input */
header {
grid-area: header;
}
/* output */
header {
grid-area: "a";
}
将值设为字符串会破坏 css 网格功能。
将reduceIdents
的gridTemplate
设置为false
:
// postcss.config.js
module.exports = {
plugins: [
require('postcss-import')(),
require('postcss-url')(),
require('cssnano')({
preset: [
'advanced',
{
discardComments: {
removeAllButFirst: true,
},
reduceIdents: {
gridTemplate: false,
},
autoprefixer: {},
},
],
}),
],
};
cssnano v4 将命名的网格区域变成带引号的字符串而不是 custom-identifiers,例如:
/* input */
header {
grid-area: header;
}
/* output */
header {
grid-area: "a";
}
将值设为字符串会破坏 css 网格功能。
将reduceIdents
的gridTemplate
设置为false
:
// postcss.config.js
module.exports = {
plugins: [
require('postcss-import')(),
require('postcss-url')(),
require('cssnano')({
preset: [
'advanced',
{
discardComments: {
removeAllButFirst: true,
},
reduceIdents: {
gridTemplate: false,
},
autoprefixer: {},
},
],
}),
],
};