css-namespace

1.0.6 • Public • Published

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

npm install --save-dev css-namespace

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

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

Using npx

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.

/css-namespace/

    Package Sidebar

    Install

    npm i css-namespace

    Weekly Downloads

    370

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    22.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • kierancrown