Skip to content

Latest commit

 

History

History
43 lines (32 loc) · 1.19 KB

README.md

File metadata and controls

43 lines (32 loc) · 1.19 KB

PostCSS Plugin Namespace Build Statusnpmnpm

PostCSS A PostCSS plugin that could add css selector before all selectors,so that the styles will not affect other projects.

Usage

passed a css selector as the first argument;

postcss([ require('postcss-plugin-namespace')('.insert-selector') ])

input

.foo {
    /* Input example */
}

output

.insert-selector .foo {
  /* Output example */
}

Options

Pass an options object as the second argument.

options.ignore

Don't prefix specific classes or classes that match a regex.

var css = postcss([namespace('.test', { ignore: [ /body/, ".icon" ] })])
  .process(inputCSS)
  .then(results => {results.toString()});

See PostCSS docs for examples for your environment.