# remove-class-names-plugin

> Remove classes from .css that don't exist as a "className" in a React.js bundle.

Latest version **1.0.1** (published 2017-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install remove-class-names-plugin
pnpm add remove-class-names-plugin
yarn add remove-class-names-plugin
bun add remove-class-names-plugin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-02-18 |
| First published | 2017-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matt McDaniel |
| Maintainers | himmel |

## Links

- npm: https://www.npmjs.com/package/remove-class-names-plugin
- npm.io page: https://npm.io/package/remove-class-names-plugin

## Recent versions

- 1.0.1 (latest) — 2017-02-18
- 1.0.0 — 2017-02-18

## README

# Remove classNames
## Webpack Plugin
### Optimize CSS builds in React projects

```
new RemoveClassNamesPlugin()
```


Remove classes from .css that don't exist as a "className" in a React.js bundle.

---
## Usage
**webpack.config.js**
```
module.exports = {
	plugins: [
		new RemoveClassNamesPlugin()
	]
}
```

---
## Example

### Before

**index.js**
```
const Postcard = (props) => {
	return (
		<div className="postcard">
			Hello from San Diego!
		</div>
	)
};

...
```

**build/styles.css**
```
.postcard {
  background-color: cornsilk;
  width: 400px;
  height: 200px;
  text-align: center; }

// 😕
.postcard__unused {
  color: red; }
```

### After

**build/styles.css**

Classes that have been placed into stylesheets, but not used in a React codebase will not be present in your final css output.
```
.postcard {
  background-color: cornsilk;
  width: 400px;
  height: 200px;
  text-align: center; }

// 🏄🏽
```

---
_Source: https://npm.io/package/remove-class-names-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
