# postcss-class-prefix

> A class prefixer/namespacer for postcss

Latest version **0.3.0** (published 2015-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-class-prefix
pnpm add postcss-class-prefix
yarn add postcss-class-prefix
bun add postcss-class-prefix
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2015-09-10 |
| First published | 2015-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+6 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 81 |
| Maintainers | thompsongl |
| Keywords | css, postcss, postcss-plugin |

## Links

- npm: https://www.npmjs.com/package/postcss-class-prefix
- Repository: https://github.com/thompsongl/postcss-class-prefix
- Homepage: https://github.com/thompsongl/postcss-class-prefix#readme
- Issues: https://github.com/thompsongl/postcss-class-prefix/issues
- npm.io page: https://npm.io/package/postcss-class-prefix

## Dependencies (1)

- [postcss](https://npm.io/package/postcss.md) ^5.0.4

## 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

- 0.3.0 (latest) — 2015-09-10
- 0.2.0 — 2015-06-01
- 0.1.0 — 2015-03-17

## README

# postcss-class-prefix [![Build Status](https://secure.travis-ci.org/thompsongl/postcss-class-prefix.png?branch=master)](http://travis-ci.org/thompsongl/postcss-class-prefix)

A [PostCSS](https://github.com/postcss/postcss) plugin to prefix/namespace classes.

Avoid collisions with other libraries/stylesheets by prefixing your components with a namespace.

__Example input__

```css
.Component { /* ... */ }
.Component--modifier { /* ... */ }
.Component-descendent { /* ... */ }
```

__Example output__
`classPrefix('pfx-')`
```css
.pfx-Component { /* ... */ }
.pfx-Component--modifier { /* ... */ }
.pfx-Component-descendent { /* ... */ }
```


## Installation

```
npm install postcss-class-prefix
```

## Usage

```javascript
var fs        = require('fs');
var postcss   = require('postcss');
var classPrfx = require('postcss-class-prefix');

var css = fs.readFileSync('css/my-file.css', 'utf8').toString();
var out = postcss()
          .use(classPrfx('my-prefix-'))
          .process(css);
```

### Using the `ignore` option

```javascript
var fs        = require('fs');
var postcss   = require('postcss');
var classPrfx = require('postcss-class-prefix');

var css = fs.readFileSync('css/my-file.css', 'utf8').toString();
var out = postcss()
          .use(classPrfx('my-prefix-', { ignore: [/ng-/, 'some-class-to-ignore']}))
          .process(css);
```

## License

MIT

## Acknowledgements

* Based on [rework-class-prefix](https://github.com/jnv/rework-class-prefix) ([originally](https://github.com/johnotander/rework-class-prefix))

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