Skip to content

0.1.0

Compare
Choose a tag to compare
@littledivy littledivy released this 27 Oct 17:03
· 4 commits to main since this release

css_parser

CSS Lexer & Parser implementation for Deno

  • CSS parser and lexer
  • Preserves comments and position in the AST when specified
  • Parses whole of Bootstrap 3.3.7 in <108ms

Usage

Parse CSS to AST -

import { parse } from "https://deno.land/x/css@0.1.0/mod.ts";

let ast = parse("/* comment */ p { color: black; }", {/* OPTIONS */})
// {
//   type: "stylesheet",
//   stylesheet: {
//     rules: [
//       { type: "comment", text: " comment ", position: [Object] },
//       { type: "rule", selectors: [Array], declarations: [Array], position: [Object] }
//     ]
// }