css-tokenize 0.1.0

A CSS tokenizer following CSS Syntax Level 3, in safe Rust without dependencies
Documentation
  • Coverage
  • 100%
    44 out of 44 items documented1 out of 7 items with examples
  • Size
  • Source code size: 68.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 458.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • casoon/barrierlab
    1 0 2
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • casoon

css-tokenize

A pure-Rust, dependency-free tokenizer for CSS Syntax Module Level 3 (§3 preprocessing and §4 tokenization). It turns a &str into CSS tokens and nothing else: grammars on top of the tokens (media queries, selectors, stylesheets) live in other crates.

use css_tokenize::{Token, tokenize};

let tokens = tokenize("a:hover");
assert!(matches!(tokens[0], Token::Ident(_)));

Extracted from media-query-parse, which still re-exports it as media_query_parse::tokenizer. Used by media-query-parse and stylesheet-parse.

License

MIT