pc__replace_id_in_css

This is plugin for nmp-package "Post-Compression". He`s searching and replaces long value "id" on short value, in the CSS code.

Usage no npm install needed!

<script type="module">
  import pcReplaceIdInCss from 'https://cdn.skypack.dev/pc__replace_id_in_css';
</script>

README

Replace id in CSS

This is plugin for nmp-package "Post-Compression".
He`s searching and replaces long value "id" on short value, in the CSS code.

An example of using:

var replaceIdInCSS = require("pc__replace_id_in_css");

gulp.src("./*.css")
    .pipe(postCompression.replace([
        replaceIdInCSS()
    ], shortNames));

Where:

  • shortNames - an object of type JSON with rules replace the long words to short words.

An example of the JSON object "shortNames":

{
    "id_in_css": {        // the name of the group names
        "someIdA": "a",   // long name: short name
        "someIdB": "b"
    }
}

An example of CSS code before:

#someIdA,
#someIdB {
    ...
}

An example of CSS code after:

#a,
#b {
    ...
}