# postcss-scopify

> PostCSS plugin that adds a user input scope to each selector

Latest version **1.0.0** (published 2024-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install postcss-scopify
pnpm add postcss-scopify
yarn add postcss-scopify
bun add postcss-scopify
```

## 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.0 |
| Published | 2024-07-26 |
| First published | 2015-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 58.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | pazams |
| Maintainers | pazams |
| Keywords | postcss, css, postcss-plugin, scope, scoped css, css post processing |

## Links

- npm: https://www.npmjs.com/package/postcss-scopify
- Repository: https://github.com/pazams/postcss-scopify
- Issues: https://github.com/pazams/postcss-scopify/issues
- npm.io page: https://npm.io/package/postcss-scopify

## Dependencies (1)

- [postcss-selector-parser](https://npm.io/package/postcss-selector-parser.md) ^6.0.6

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

- 1.0.0 (latest) — 2024-07-26
- 0.1.10 — 2022-05-16
- 0.1.9 — 2016-09-26
- 0.1.8 — 2016-04-17
- 0.1.7 — 2016-03-30
- 0.1.6 — 2015-12-08
- 0.1.5 — 2015-12-08
- 0.1.4 — 2015-12-05
- 0.1.3 — 2015-07-25
- 0.1.2 — 2015-07-25
- 0.1.1 — 2015-07-25
- 0.1.0 — 2015-07-05

## README

# PostCSS Scopify

[![Node.js CI](https://github.com/pazams/postcss-scopify/actions/workflows/node.js.yml/badge.svg)](https://github.com/pazams/postcss-scopify/actions/workflows/node.js.yml)
[![Test coverage][coveralls-image]][coveralls-url]
[![Downloads][downloads-image]][downloads-url]

[PostCSS] plugin that adds a user input scope to each selector.
for a command line interface, see [scopify-cli]. 

[`poststylus`]: https://github.com/seaneking/poststylus
[PostCSS API]:  https://github.com/postcss/postcss/blob/master/docs/api.md
[Broccoli]:     https://github.com/jeffjewiss/broccoli-postcss
[CLI tool]:     https://github.com/code42day/postcss-cli
[webpack]:      https://github.com/postcss/postcss-loader
[Brunch]:       https://github.com/iamvdo/postcss-brunch
[Grunt]:        https://github.com/nDmitry/grunt-postcss
[Gulp]:         https://github.com/postcss/gulp-postcss
[ENB]:          https://github.com/theprotein/enb-postcss

[travis-image]: https://img.shields.io/travis/pazams/postcss-scopify.svg?style=flat-square
[travis-url]: https://travis-ci.org/pazams/postcss-scopify
[coveralls-image]: https://img.shields.io/coveralls/pazams/postcss-scopify.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/pazams/postcss-scopify
[downloads-image]: https://img.shields.io/npm/dm/postcss-scopify.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/postcss-scopify

[scopify-cli]: https://github.com/pazams/scopify-cli
[PostCSS]: https://github.com/postcss/postcss

__Example input__

```css
.foo, .boo h1 {
    /* declarations */
}

& {
    /* declarations */
}
```
__Example output__
`scopify('#scope')` or `scopify({scope: '#scope'})`
```css
#scope .foo, #scope .boo h1 {
    /* declarations */
}

#scope {
    /* declarations */
}
```

## Installation

```
npm install postcss-scopify
```

## Usage

```javascript
var fs        = require('fs');
var postcss   = require('postcss');
var scopify   = require('postcss-scopify');

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

You can use PostCSS with your build tool.
Note there are plugins for [Grunt], [Gulp], [webpack], [Broccoli],
[Brunch] and [ENB]. 
See [PostCSS] docs for examples for your environment.

## Change Log
### v1.0.0
- update all deps to latest versions
- update plugin syntax for postCss v8+
- allow pass scope as object (because postcss+webpack)

### v0.1.8
closes [#10](https://github.com/pazams/postcss-scopify/issues/10)

### v0.1.7
fixes [#7](https://github.com/pazams/postcss-scopify/issues/7)

### v0.1.5
closes [#3](https://github.com/pazams/postcss-scopify/issues/3)

### v0.1.4
fixes [#4](https://github.com/pazams/postcss-scopify/issues/4)

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