使用craco配置全局sass

使用craco配置全局sass

下载craco-sass-resources-loader

yarn add craco-sass-resources-loader
# 或者
npm i -d craco-sass-resources-loader

craco.config.js中配置

const sassResourcesLoader = require('craco-sass-resources-loader');

module.exports = {
plugins: [
{
  plugin: sassResourcesLoader,
  options: {
      resources: [
          './src/assets/styles/common/common.scss',
          './src/assets/styles/common/global.scss',
          './src/assets/styles/common/keyframes.scss',
          './src/assets/styles/common/media.scss',
          './src/assets/styles/other/hover-min.scss',
          './src/assets/styles/other/normal.scss',
    ],
  },
},
],
}

你可能感兴趣的:(react学习,sass,前端,css)