# css-namespace

> This utility takes a css file (input) and prefixes (namespaces) the css rules with a predefined selector

Latest version **1.0.6** (published 2023-09-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install css-namespace
pnpm add css-namespace
yarn add css-namespace
bun add css-namespace
```

Provides the command `css-namespace`.

## 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.6 |
| Published | 2023-09-02 |
| First published | 2023-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 22 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Kieran Crown |
| Maintainers | kierancrown |

## Links

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

## Dependencies (2)

- [css](https://npm.io/package/css.md) ^3.0.0
- [command-line-args](https://npm.io/package/command-line-args.md) ^5.2.1

## Recent versions

- 1.0.6 (latest) — 2023-09-02
- 1.0.5 — 2023-09-02
- 1.0.4 — 2023-09-01
- 1.0.3 — 2023-09-01
- 1.0.1 — 2023-09-01
- 1.0.0 — 2023-09-01

## README

# CSS Namespace

This utility takes a css file (input) and prefixes (namespaces) the css rules with a predefined selector.

## Why

I needed to add a selector to every single rule in a large CSS file post build. I couldn't find anything that did what I needed, so I built it!

## Running

You can run this by either installing this package as a dev dependency or by using npx.

### Install as a dev dependency

```bash
npm install --save-dev css-namespace
```

You can then add a script to your package.json file to run the utility.

```json
{
    "scripts": {
        "build-css": "css-namespace -i ./src/styles.css -s #app -w"
    }
}
```

### Using npx

```bash
npx css-container -i ./src/styles.css -s #app -w
```

### Command Line Args

| Argument  | Alias | Type    | Default Value  | Description                                         |
| --------- | ----- | ------- | -------------- | --------------------------------------------------- |
| verbose   | v     | Boolean | false          | Enable verbose mode for detailed output.            |
| input     | i     | String  |                | Specify the input file or data source.              |
| selector  | s     | String  |                | Define a selector for filtering data.               |
| output    | o     | String  | './output.css' | Specify the output file or destination.             |
| overwrite | w     | Boolean | false          | Overwrite the original css file (output is ignored) |
| pretty    |       | Boolean | false          | Enable pretty formatting for the output data.       |

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