Closed DLHTX closed 3 years ago
@DLHTX 项目没有使用 less 哈,语法是通过 postcss-loader 支持的;报错看看 vscode 是否安装了 stylelint 插件喔。
感谢up已经解决了,因为我是用的eject暴露的webpack配置,后来发现是要加入postcss-nested ,webpack中也需要加入配置,学到了哦。
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-nested'),
require('postcss-flexbugs-fixes'),
require('postcss-preset-env')({
autoprefixer: {
flexbox: 'no-2009',
},
stage: 3,
}),
// Adds PostCSS Normalize as the reset css with default options,
// so that it honors browserslist config in package.json
// which in turn let's users customize the target behavior as per their needs.
postcssNormalize(),
],
sourceMap: isEnvProduction ? shouldUseSourceMap : isEnvDevelopment,
},
从b站来的,看到了up的代码获益匪浅,其中遇到了一个问题是,这种类似less的写法在我的编辑器中好像没有识别,而且我这么写编辑器会报红,下面的css也没有执行,查看了webpack好像也没有加入less之类的东西,想请问这是什么原因?