3 unstable releases

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

#1385 in Parser implementations

Download history 12057/week @ 2023-07-30 14920/week @ 2023-08-06 15523/week @ 2023-08-13 12186/week @ 2023-08-20 11247/week @ 2023-08-27 13742/week @ 2023-09-03 14125/week @ 2023-09-10 12029/week @ 2023-09-17 13237/week @ 2023-09-24 11444/week @ 2023-10-01 12554/week @ 2023-10-08 12198/week @ 2023-10-15 13141/week @ 2023-10-22 13966/week @ 2023-10-29 13848/week @ 2023-11-05 16783/week @ 2023-11-12

58,914 downloads per month
Used in 233 crates (5 directly)

MIT/Apache

45KB
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

~78KB