Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: 0.0.1
Fetching contributors…

Cannot retrieve contributors at this time

76 lines (53 sloc) 1.225 kB

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 is a string, treat opts as opts.prefix.

install

With npm do:

npm install css-prefix

license

MIT

Jump to Line
Something went wrong with that request. Please try again.