Skip to content

dPacc/craco-less-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License

Craco Less Plugin

This is a craco Less & Less Modules plugin, support create-react-app version >= 3.

Installation

Then install craco-less-plugin:

$ yarn add craco-less-plugin

Usage

Here is a complete craco.config.js configuration file that adds Less compilation to create-react-app:

const CracoLessPlugin = require('craco-less-plugin')
module.exports = {
  plugins: [{ plugin: CracoLessPlugin }]
}

Options

View the less-loader documentation

For example:

const CracoLessPlugin = require('craco-less-plugin')

module.exports = {
  plugins: [
    {
      plugin: cracoLessPlugin,
      options: {
        modifyVars: {
          hack: `true;@import "${require.resolve('./src/theme.less')}";`
        },
        javascriptEnabled: true
      }
    }
  ]
}

CSS Modules

using the [name].module.less file naming convention

For example:

Button.module.less

.button {
  background-color: red;
}

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published