Skip to content
Newer
Older
100644 76 lines (53 sloc) 1.2 KB
72a9a16 @substack readme with examples yay
authored
1 css-prefix
2 ==========
3
4 Insert a prefix into css documents.
5
288f53f @substack using travis
authored
6 [![build status](https://secure.travis-ci.org/substack/css-prefix.png)](http://travis-ci.org/substack/css-prefix)
7
72a9a16 @substack readme with examples yay
authored
8 example
9 =======
10
11 ``` js
12 var fs = require('fs');
13 var src = fs.readFileSync(__dirname + '/beep.css', 'utf8');
14
15 var insertPrefix = require('css-prefix');
16 var dst = insertPrefix('RAWR-', src);
17 console.log(dst);
18 ```
19
20 beep.css:
21
22 ``` css
23 #beep div.boop.killer-robots {
24 color: red;
25 }
26
27 #beep .friendly-robots {
28 color: green;
29 }
30 ```
31
32 output:
33
34 ``` css
35 #RAWR-beep div.RAWR-boop.RAWR-killer-robots {
36 color: red;
37 }
38
39 #RAWR-beep .RAWR-friendly-robots {
40 color: green;
41 }
42 ```
43
44 methods
45 =======
46
47 ``` js
48 var insertPrefix = require('css-prefix')
49 ```
50
2aca8ca @substack document opts.elementClass, bump
authored
51 insertPrefix(opts, src)
52 -----------------------
72a9a16 @substack readme with examples yay
authored
53
2aca8ca @substack document opts.elementClass, bump
authored
54 Insert the string `opts.prefix` before every class and id in the css source
55 string `src`, returning the transformed source.
56
57 If `opts.elementClass` is given, add this class to all element identifiers. This
58 is useful so that your `h1 { color: green; }` declarations don't leak into the
59 environment.
60
61 If `opts` is a string, treat `opts` as `opts.prefix`.
72a9a16 @substack readme with examples yay
authored
62
63 install
64 =======
65
66 With [npm](http://npmjs.org) do:
67
68 ```
69 npm install css-prefix
70 ```
71
72 license
73 =======
74
75 MIT
Something went wrong with that request. Please try again.