craco-less-compiler
v1.4.0
Published
Less to CSS made easy with our Craco plugin. Optimize your stylesheets and boost your front-end development workflow today.
Downloads
155
Readme
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;
}