OLD | NEW |
1 CSS parser library for Dart | 1 CSS parser library for Dart |
2 ========================== | 2 ========================== |
3 | 3 |
4 This is a [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) parser written
entirely in [Dart][dart]. | 4 This is a [CSS](https://developer.mozilla.org/en-US/docs/Web/CSS) parser written
entirely in [Dart][dart]. |
5 It can be used in the client/server/command line. | 5 It can be used in the client/server/command line. |
6 | 6 |
7 This package is installed with [Pub][pub], see: | 7 This package is installed with [Pub][pub], see: |
8 [install instructions](https://pub.dartlang.org/packages/csslib#installing) | 8 [install instructions](https://pub.dartlang.org/packages/csslib#installing) |
9 for this package. | 9 for this package. |
10 | 10 |
11 Usage | 11 Usage |
12 ----- | 12 ----- |
13 | 13 |
14 Parsing CSS is easy! | 14 Parsing CSS is easy! |
15 ```dart | 15 ```dart |
16 import 'package:csslib/parser.dart' show parse; | 16 import 'package:csslib/parser.dart'; |
17 import 'package:csslib/css.dart'; | |
18 | 17 |
19 main() { | 18 main() { |
20 var stylesheet = parse( | 19 var stylesheet = parse( |
21 '.foo { color: red; left: 20px; top: 20px; width: 100px; height:200px }'); | 20 '.foo { color: red; left: 20px; top: 20px; width: 100px; height:200px }'); |
22 print(stylesheet.toString()); | 21 print(stylesheet.toDebugString()); |
23 } | 22 } |
24 ``` | 23 ``` |
25 | 24 |
26 You can pass a String or list of bytes to `parse`. | 25 You can pass a String or list of bytes to `parse`. |
27 | 26 |
28 | 27 |
29 Running Tests | 28 Running Tests |
30 ------------- | 29 ------------- |
31 | 30 |
32 Basic tests can be found in this repository: | 31 Basic tests can be found in this repository: |
33 ```bash | 32 ```bash |
34 pub run test | 33 pub run test |
35 ``` | 34 ``` |
36 | 35 |
37 The full CSS test suite can be found in https://github.com/dart-lang/csslib-test
-suite | 36 The full CSS test suite can be found in https://github.com/dart-lang/csslib-test
-suite |
38 ```bash | 37 ```bash |
39 cd ../csslib-test-suite | 38 cd ../csslib-test-suite |
40 ./run.sh | 39 ./run.sh |
41 ``` | 40 ``` |
42 | 41 |
43 [dart]: http://www.dartlang.org/ | 42 [dart]: http://www.dartlang.org/ |
44 [pub]: http://www.dartlang.org/docs/pub-package-manager/ | 43 [pub]: http://www.dartlang.org/docs/pub-package-manager/ |
OLD | NEW |