1
1
# CSS Parser
2
2
3
- [ ![ build status] ( https://secure.travis-ci.org/CSSLint/parser-lib.svg )] ( http ://travis-ci.org/CSSLint/parser-lib)
3
+ [ ![ build status] ( https://secure.travis-ci.org/CSSLint/parser-lib.svg?branch=master )] ( https ://travis-ci.org/CSSLint/parser-lib)
4
4
5
5
## Introduction
6
6
@@ -30,6 +30,7 @@ var parser = new parserlib.css.Parser();
30
30
31
31
Alternatively, you can copy a single file version of the parser from
32
32
` dist/node-parserlib.js ` to your own project, and use it as follows:
33
+
33
34
``` js
34
35
var parserlib = require (" ./node-parserlib" );
35
36
```
@@ -38,31 +39,38 @@ var parserlib = require("./node-parserlib");
38
39
39
40
To use the CSS parser in a Rhino script, copy the file
40
41
` dist/parserlib.js ` to your project and then include it at the beginning:
42
+
41
43
``` js
42
44
load (" parserlib.js" );
43
45
```
44
46
45
47
### HTML page
46
48
47
49
To use the CSS parser on an HTML page, you can either include the entire library on your page:
50
+
48
51
``` html
49
52
<script src =" parserlib.js" ></script >
50
53
```
54
+
51
55
Or include it as its component parts, the ParserLib core and the CSS parser:
56
+
52
57
``` html
53
58
<script src =" parserlib-core.js" ></script >
54
59
<script src =" parserlib-css.js" ></script >
55
60
```
61
+
56
62
Note that parsing large JavaScript files may cause the browser to
57
63
become unresponsive. All three of these files are located in the
58
64
` dist ` directory.
59
65
60
66
## Basic usage
61
67
62
68
You can create a new instance of the parser by using the following code:
69
+
63
70
``` js
64
71
var parser = new parserlib.css.Parser ();
65
72
```
73
+
66
74
The constructor accepts an options object that specifies additional features the parser should use. The available options are:
67
75
68
76
* ` starHack ` - set to true to treat properties with a leading asterisk as if the asterisk wasn't there. Default is false.
0 commit comments