Fixes parsing hex number when identifier follows

If an identifier followed a hex number, it would be treated as part of the hex
number. For example, `#000 url(...)` would be parsed as `#000url` which would be
labeled as a bad hex value.

Now the parser correctly recognizes whitespace following a hex number to prevent
this issue.
2 files changed
tree: f9cebfa736332e58690d3dd940698604f29106c2
  1. .analysis_options
  2. .gitignore
  3. .test_config
  7. bin/
  8. codereview.settings
  9. example/
  10. lib/
  11. pubspec.yaml
  12. test/

CSS parser library for Dart

This is a CSS parser written entirely in Dart. It can be used in the client/server/command line.

This package is installed with Pub, see: install instructions for this package.


Parsing CSS is easy!

import 'package:csslib/parser.dart' show parse;
import 'package:csslib/css.dart';

main() {
  var stylesheet = parse(
      '.foo { color: red; left: 20px; top: 20px; width: 100px; height:200px }');

You can pass a String or list of bytes to parse.

Running Tests

Basic tests can be found in this repository:

pub run test

The full CSS test suite can be found in

cd ../csslib-test-suite