less-modulesify
A browserify plugin support CSS Modules feature for less.
Getting started
First install the package: npm install --save less-modulesify
Applying a class to an element you can do something like:
styles.less
.exContent height: 100px; width: 100px; background-color: red;
main.js
var styles = ;var content = document;contentclassName = stylesexContent;
Then using browserify to build it: browserify -p [less-modulesify] main.js > bundle.js
API Usage
// Basic Usage, css will be inlinevar b = ; b;b;b;
// Output the css file,the base filename will not changevar b = ;b;b;b;
Options:
global
: browserify's global transformingexclude
: the files those will not be transformed. Files can be globsmodulesifyExclude
: the files those will not be modulesify transformed. Files can be globsoutputDir
: the target css will be written into this directory.When not setting it,the style will be inline.sourceMap
: using sourceMap or not. Support inline-sourceMap onlylessCompileOption
: you can using original less options here(like: plugins,compress...),excepts sourcemap, for more just see the less docs
Examples:
Just in this project's examples folder
Licence
MIT