# rework-css-prefix

> Add a class prefix to further sandbox CSS styling.

Latest version **0.0.1** (published 2015-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install rework-css-prefix
pnpm add rework-css-prefix
yarn add rework-css-prefix
bun add rework-css-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.0.1 |
| Published | 2015-10-22 |
| First published | 2015-10-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | fatsheepcn |
| Maintainers | fatsheepcn |
| Keywords | rework, class, class-prefix, css, css-prefix |

## Links

- npm: https://www.npmjs.com/package/rework-css-prefix
- Repository: https://github.com/fatsheepcn/rework-css-prefix
- Issues: https://github.com/fatsheepcn/rework-css-prefix/issues
- npm.io page: https://npm.io/package/rework-css-prefix

## Dependencies (2)

- [rework](https://npm.io/package/rework.md) ^1.0.1
- [is-present](https://npm.io/package/is-present.md) 0.0.1

## 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.0.1 (latest) — 2015-10-22

## README

# rework-css-prefix

Add a class prefix to further sandbox CSS styling for third-party imports.

This is a fix version from johnotander/rework-class-prefix <https://github.com/johnotander/rework-class-prefix>


This comes in handy when you want to import two different CSS modules that might
have conflictings styles. For example, if module A and module B both have a
`.media` class selector that have different use cases, you can run them through
`rework-css-prefix` and result in something like `.a-media` and `.b-media`.

__Example input__

```css
.grid { /* ... */ }
.grid-row { /* ... */ }
.grid-row-col { /* ... */ }

[class^="icon-"]
[class*=" icon-"]
```

__Example output__
`cssPrefix('flx-')`
```css
.flx-grid { /* ... */ }
.flx-grid-row { /* ... */ }
.flx-grid-row-col { /* ... */ }

[class^="flx-icon-"]
[class*=" flx-icon-"]
```

## Installation

```
npm install --save rework-css-prefix
```

## Usage

```javascript
var fs        = require('fs'),
    rework    = require('rework'),
    cssPrfx = require('rework-css-prefix');

var css = fs.readFileSync('css/my-file.css', 'utf8').toString();
var out = rework(css).use(cssPrfx('my-prefix-')).toString();
```
#### In a gulpfile

```js
var gulp        = require('gulp'),
    name        = require('gulp-rename'),
    rework      = require('gulp-rework'),
    reworkNPM   = require('rework-npm'),
    cssPrefix = require('rework-css-prefix');

gulp.task('css', function() {
  return gulp.src('index.css')
    .pipe(rework(reworkNPM(), cssPrefix('prfx-')))
    .pipe(name('index-prefixed.css'))
    .pipe(gulp.dest('css'));
});
```

### Using the `ignored` option

```javascript
var fs  = require('fs'),
rework  = require('rework'),
cssPrfx = require('rework-css-prefix');

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

## License

MIT

## Acknowledgements

* johnotander/rework-class-prefix <https://github.com/johnotander/rework-class-prefix>.
* Built on top of <https://github.com/reworkcss/rework>.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

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