1.2.2 • Published 2 years ago
craco-style-resources-loader v1.2.2
Craco style-resources-loader
This is a craco plugin to add style-resources-loader with create-react-app version >= 2.
Inspired by: https://github.com/tilap/craco-sass-resources-loader
Installation
$ yarn add -D craco-style-resources-loader
# OR
$ npm install craco-style-resources-loader --save-devUsage
craco-style-resources-loader expect a patterns option containing a string or an array of
string pointing the CSS files your want to load before any CSS/styles file.
const stylesResourcesLoader = require('craco-style-resources-loader');
module.exports = {
  plugins: [
    {
      plugin: stylesResourcesLoader,
      options: {
        patterns: './src/variables.css',
      },
    },
  ],
}You can load multiple CSS files too:
const stylesResourcesLoader = require('craco-style-resources-loader');
module.exports = {
  plugins: [
    {
      plugin: stylesResourcesLoader,
      options: {
        patterns: [
          './src/global-variables.css',
          './src/theme-variables.css'
        ],
      },
    },
  ],
}