# modular-css-webpack

> Webpack support for modular-css

Latest version **15.0.0** (published 2018-08-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install modular-css-webpack
pnpm add modular-css-webpack
yarn add modular-css-webpack
bun add modular-css-webpack
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 15.0.0 |
| Published | 2018-08-28 |
| First published | 2017-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 15.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 289 |
| Author | Pat Cavit |
| Maintainers | tivac |
| Keywords | webpack, webpack-plugin, webpack-loader, css, css-modules, modular-css, postcss |

## Links

- npm: https://www.npmjs.com/package/modular-css-webpack
- Repository: https://github.com/tivac/modular-css
- Homepage: https://github.com/tivac/modular-css#readme
- Issues: https://github.com/tivac/modular-css/issues
- npm.io page: https://npm.io/package/modular-css-webpack

## Dependencies (5)

- [esutils](https://npm.io/package/esutils.md) ^2.0.2
- [loader-utils](https://npm.io/package/loader-utils.md) ^1.1.0
- [lodash.ismap](https://npm.io/package/lodash.ismap.md) ^4.4.2
- [webpack-sources](https://npm.io/package/webpack-sources.md) ^1.0.1
- [modular-css-core](https://npm.io/package/modular-css-core.md) ^15.0.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 15.0.0 (latest) — 2018-08-28
- 5.0.0-rc1 (next) — 2017-05-12
- 4.0.1 (lerna) — 2017-02-18
- 14.4.0 — 2018-08-10
- 14.3.0 — 2018-08-09
- 14.2.1 — 2018-08-01
- 14.2.0 — 2018-07-25
- 14.1.0 — 2018-07-18
- 14.0.1 — 2018-07-16
- 14.0.0 — 2018-07-13
- 13.0.0 — 2018-07-13
- 12.1.3 — 2018-07-05
- 12.1.2 — 2018-07-05
- 12.1.0 — 2018-06-26
- 12.0.2 — 2018-06-22
- … 40 more at https://npm.io/package/modular-css-webpack/versions

## README

modular-css-webpack  [![NPM Version](https://img.shields.io/npm/v/modular-css-webpack.svg)](https://www.npmjs.com/package/modular-css-webpack) [![NPM License](https://img.shields.io/npm/l/modular-css-webpack.svg)](https://www.npmjs.com/package/modular-css-webpack) [![NPM Downloads](https://img.shields.io/npm/dm/modular-css-webpack.svg)](https://www.npmjs.com/package/modular-css-webpack)
===========

<p align="center">
    <a href="https://gitter.im/modular-css/modular-css"><img src="https://img.shields.io/gitter/room/modular-css/modular-css.svg" alt="Gitter" /></a>
</p>

Webpack 2/3/4 support for [`modular-css`](https://github.com/tivac/modular-css).

This package contains two entry points, you will need to use **both** in tandem for things to work!

1. `modular-css-webpack/plugin` provides a webpack plugin you can use to transform imported `.css` files into lookup objects while outputting CSS to disk.

2. `modular-css-webpack/loader` provides the file loader that does the actual transformation on files.

## Usage

```js
// webpack.config.js
var path = require("path"),
    
    CSSPlugin = require("modular-css-webpack/plugin");

module.exports = {
    entry   : "./input.js",
    output  : {
        path : path.resolve(__dirname, "dist"),
        filename : "./output.js"
    },
    module : {
        rules : [{
            test : /\.css$/,
            use  : "modular-css-webpack/loader"
        }]
    },
    plugins : [
        new CSSPlugin({
            css  : "./output.css",
            json : "./output.json"
        })
    ]
});
```

## Options

### Plugin Options

#### `css`

Location to write the generated CSS file to, relative to `output.path` just like `output.filename`

#### `json`

Location to write out the JSON mapping file to, relative to `output.path` just like `output.filename`

#### Shared Options

All other options are passed to the underlying `Processor` instance, see [Options](https://github.com/tivac/modular-css/blob/master/docs/api.md#options).

### Loader Options

#### `namedExports`

By default this plugin will create both a default export and named `export`s for each class in a CSS file. You can disable this by setting `namedExports` to `false`.

```js
...
    module : {
        rules : [{
            test : /\.css$/,
            use  : {
                loader  : "modular-css-webpack/loader",
                options : {
                    namedExports : false
                }
            }
        }]
    },
...
```

---
_Source: https://npm.io/package/modular-css-webpack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
