使用craco-sass-resources-loader条件需要先安装@craco/craco。
安装craco-sass-resources-loader依赖
$ yarn add -D craco-sass-resources-loader
# OR
$ npm install craco-sass-resources-loader --save-dev
单变量文件配置
const sassResourcesLoader = require('craco-sass-resources-loader');
module.exports = {
plugins: [
{
plugin: sassResourcesLoader,
options: {
resources: './src/my-config-theme.scss',
},
},
],
}
多个变量文件配置
const sassResourcesLoader = require('craco-sass-resources-loader');
module.exports = {
plugins: [
{
plugin: sassResourcesLoader,
options: {
resources: [
'./src/my-config-theme.scss',
'./src/my-other-config-theme.scss'
],
},
},
],
}
网友评论