我正在尝试将customMedia 选项添加到带有文件位置的 postcss-cssnext功能配置中importFrom
,但这不起作用,并且我在项目构建中没有任何错误,只有Missing @custom-media definition for '--small-viewport'. The entire rule has been removed from the output.
在我尝试使用媒体时才最终确定。我该如何调试?
module.exports = {
plugins: [
require('postcss-import')(),
require('postcss-nested')(),
require('postcss-simple-vars')({
variables: {
...require('./src/ui/variables')
}
}),
require('postcss-cssnext')({
features: {
customProperties: false,
browsers: ['> 0.5%, last 2 versions, Firefox ESR, not dead'],
customMedia: {
importFrom: require('path').join(__dirname, './src/ui/custom-media.css')
}
},
}),
require('cssnano')({
autoprefixer: false,
zindex: false,
reduceIdents: false,
discardComments: { removeAll: true },
discardUnused: { fontFace: false },
colormin: false,
}),
]
};