prefix-css-node
Prefix CSS selectors to avoid library clashes
Last updated 7 years ago by radekstepan .
Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install prefix-css-node 
SYNC missed versions from official npm registry.

Prefix CSS selectors.

Useful when loading say Twitter Bootstrap libraries for a widget on the page and we do not want to override the default style of that page.

Requirements

$ npm install -d

Use

The library runs synchronously.

prefix = require 'prefix-css-node'

css = """
body { background:pink }
a:after { content:"link", display:block }
"""

# To prefix each rule in the CSS file with the word `bootstrap`.
prefix.css css, 'bootstrap'

By default, html and body selectors are blacklisted, to change that or pass custom selectors to exclude, pass a list as the third parameter:

prefix.css css, 'bootstrap', [ 'html', 'body', 'a', '#div' ]

Testing

$ npm test

Current Tags

  • 0.4.0                                ...           latest (7 years ago)

3 Versions

  • 0.4.0                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 3
Dependencies (1)
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |