3 unstable releases

0.2.1 Jul 20, 2021
0.2.0 Aug 17, 2019
0.1.0 Jan 14, 2017

#182 in Parser implementations

Download history 1841/week @ 2021-04-08 1949/week @ 2021-04-15 2108/week @ 2021-04-22 1626/week @ 2021-04-29 2102/week @ 2021-05-06 1767/week @ 2021-05-13 2466/week @ 2021-05-20 1870/week @ 2021-05-27 1316/week @ 2021-06-03 2249/week @ 2021-06-10 2514/week @ 2021-06-17 2805/week @ 2021-06-24 2658/week @ 2021-07-01 2442/week @ 2021-07-08 3276/week @ 2021-07-15 3776/week @ 2021-07-22

9,520 downloads per month
Used in 73 crates (4 directly)

MIT/Apache

44KB
1K SLoC

simplecss

Build Status Crates.io Documentation Rust 1.37+

A simple CSS 2.1 parser and selector.

This is not a browser-grade CSS parser. If you need one, use cssparser + selectors.

Since it's very simple we will start with limitations:

Limitations

  • At-rules are not supported. They will be skipped during parsing.
  • Property values are not parsed. In CSS like * { width: 5px } you will get a width property with a 5px value as a string.
  • CDO/CDC comments are not supported.
  • Parser is case sensitive. All keywords must be lowercase.
  • Unicode escape, like \26, is not supported.

Features

  • Selector matching support.
  • The rules are sorted by specificity.
  • !import parsing support.
  • Has a high-level parsers and low-level, zero-allocation tokenizers.
  • No unsafe.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~82KB