namespace-css
Namespaces all rules found in a CSS file to make them only apply to a subset of the page.
Last updated 7 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install namespace-css 
SYNC missed versions from official npm registry.

namespace-css build status

Namespaces all rules found in a CSS file to make them only apply to a subset of the page.

namespace-css orig.css --selector .myclass -o namespaced.css
var namespaceCss = require('namespaceCss');

fs.createReadStream(infile)
  .pipe(namespaceCss({ selector: '.myclass'}))
  .pipe(process.stdout)

Installation

npm install namespace-css

Usage

namespace-css input.css <options>

  Namespaces the css in the input file according to given options.

OPTIONS:

  -s, --selector  css selector (any string) under which to namespace the rule in the input file
  -o, --out       output file to save namespaced css to (optional)

EXAMPLES:

  Namespace all rules in input.css under '.mynamespace' and save in output.css

    namespace-css input.css -s .mynamespace -o output.css

  Namespace all rules in input.css under 'article' and pipe resulting css to the terminal 

    namespace-css input.css -s article

API

namespaceCss(file, opts)

/**
 * Transforms the piped css by namespacing it to given options.
 * 
 * @name namespaceCss
 * @function
 * @param {String=} file ignored (only here to match common transform signature)
 * @param {Options} opts 
 * @param {String}  opts.selector the selector under which to namespace all css rules
 * @return {TransformStream} the stream into which to pipe original css
 */

License

MIT

Current Tags

  • 0.1.3                                ...           latest (7 years ago)

4 Versions

  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (4)
Dev Dependencies (1)

Copyright 2014 - 2017 © taobao.org |