Naval Pilgrim's Mayflower
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

css-prefix

0.0.2 • Public • Published

css-prefix

Insert a prefix into css documents.

build status

example

var fs = require('fs');
var src = fs.readFileSync(__dirname + '/beep.css', 'utf8');
 
var insertPrefix = require('css-prefix');
var dst = insertPrefix('RAWR-', src);
console.log(dst);

beep.css:

#beep div.boop.killer-robots {
    color: red;
}
 
#beep .friendly-robots {
    color: green;
}

output:

#RAWR-beep div.RAWR-boop.RAWR-killer-robots {
    color: red;
}
 
#RAWR-beep .RAWR-friendly-robots {
    color: green;
}

methods

var insertPrefix = require('css-prefix')

insertPrefix(opts, src)

Insert the string opts.prefix before every class and id in the css source string src, returning the transformed source.

If opts.elementClass is given, add this class to all element identifiers. This is useful so that your h1 { color: green; } declarations don't leak into the environment.

If opts.parentClass is given, add an ancestor class to every rule.

If opts is a string, treat opts as opts.prefix.

install

With npm do:

npm install css-prefix

license

MIT

Keywords

none

install

npm i css-prefix

Downloadsweekly downloads

675

version

0.0.2

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar