11# CSS Parser
22
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)
44
55## Introduction
66
@@ -30,6 +30,7 @@ var parser = new parserlib.css.Parser();
3030
3131Alternatively, you can copy a single file version of the parser from
3232` dist/node-parserlib.js ` to your own project, and use it as follows:
33+
3334``` js
3435var parserlib = require (" ./node-parserlib" );
3536```
@@ -38,31 +39,38 @@ var parserlib = require("./node-parserlib");
3839
3940To use the CSS parser in a Rhino script, copy the file
4041` dist/parserlib.js ` to your project and then include it at the beginning:
42+
4143``` js
4244load (" parserlib.js" );
4345```
4446
4547### HTML page
4648
4749To use the CSS parser on an HTML page, you can either include the entire library on your page:
50+
4851``` html
4952<script src =" parserlib.js" ></script >
5053```
54+
5155Or include it as its component parts, the ParserLib core and the CSS parser:
56+
5257``` html
5358<script src =" parserlib-core.js" ></script >
5459<script src =" parserlib-css.js" ></script >
5560```
61+
5662Note that parsing large JavaScript files may cause the browser to
5763become unresponsive. All three of these files are located in the
5864` dist ` directory.
5965
6066## Basic usage
6167
6268You can create a new instance of the parser by using the following code:
69+
6370``` js
6471var parser = new parserlib.css.Parser ();
6572```
73+
6674The constructor accepts an options object that specifies additional features the parser should use. The available options are:
6775
6876* ` starHack ` - set to true to treat properties with a leading asterisk as if the asterisk wasn't there. Default is false.
0 commit comments