<commit_before>[![build status](https://img.shields.io/travis/cef62/css-modules-compiler/master.svg?style=flat-square)](https://travis-ci.org/cef62/css-modules-compiler) [![npm version](https://img.shields.io/npm/v/css-modules-compiler.svg?style=flat-square)](https://www.npmjs.com/package/css-modules-compiler) [![npm downloads](https://img.shields.io/npm/dm/css-modules-compiler.svg?style=flat-square)](https://www.npmjs.com/package/css-modules-compiler) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

## CSS Modules Compiler

The compiler is a small autonomous Node.js module that can be used programmatically from JavaScript or directly from the CLI.

To use the module is enough to invoke it passing a source folder, the folder will be traversed and all the CSS files will be compiled as `css-modules`, all the generated CSS files will be merged, deduped and optimized into a single CSS file. All the `es2015` modules will be checked using an AST parser and all the `css` import declaration will be substituted with a static object containing the generated CSS class names.

The compile command accepts several options: the postcss plugins to be used when compiling css files, a blacklist of patterns used to avoid compilation of non-`css-modules` files, a target folder to duplicate the source and avoid changing the original sources and more.

## Documentation

See the [official documentation](https://cef62.github.io/css-modules-compiler)

## Install

`css-modules-compiler` is available as npm module, to use it on your project run:

```shell
npm install --save-dev css-modules-compiler
```

## Tests

```
npm test
```

## Try it
<commit_msg>docs(README): Fixed npm to be always declared as code in text<commit_after>[![build status](https://img.shields.io/travis/cef62/css-modules-compiler/master.svg?style=flat-square)](https://travis-ci.org/cef62/css-modules-compiler) [![npm version](https://img.shields.io/npm/v/css-modules-compiler.svg?style=flat-square)](https://www.npmjs.com/package/css-modules-compiler) [![npm downloads](https://img.shields.io/npm/dm/css-modules-compiler.svg?style=flat-square)](https://www.npmjs.com/package/css-modules-compiler) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

## CSS Modules Compiler

The compiler is a small autonomous Node.js module that can be used programmatically from JavaScript or directly from the CLI.

To use the module is enough to invoke it passing a source folder, the folder will be traversed and all the CSS files will be compiled as `css-modules`, all the generated CSS files will be merged, deduped and optimized into a single CSS file. All the `es2015` modules will be checked using an AST parser and all the `css` import declaration will be substituted with a static object containing the generated CSS class names.

The compile command accepts several options: the postcss plugins to be used when compiling css files, a blacklist of patterns used to avoid compilation of non-`css-modules` files, a target folder to duplicate the source and avoid changing the original sources and more.

## Documentation

See the [official documentation](https://cef62.github.io/css-modules-compiler)

## Install

`css-modules-compiler` is available as `npm` module, to use it on your project run:

```shell
npm install --save-dev css-modules-compiler
```

## Tests

```
npm test
```

## Try it

{'fraction_non_alphanumeric': 0.11171119954519614, 'fraction_numerical': 0.005685048322910745, 'mean_word_length': 4.914285714285715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497409', 'n_tokens_mistral': 1047, 'n_tokens_neox': 970, 'n_words': 362}