Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.
/ craco-less-compiler Public archive

Less to CSS made easy with our Craco plugin. Optimize your stylesheets and boost your front-end development workflow today.

Notifications You must be signed in to change notification settings

Azwedo/craco-less-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;
}

About

Less to CSS made easy with our Craco plugin. Optimize your stylesheets and boost your front-end development workflow today.

Topics

Resources

Stars

Watchers

Forks