{"library":"shady-css-parser","title":"Shady CSS Parser","description":"Shady CSS Parser is a JavaScript library designed for fast, small, and flexible runtime parsing and transformation of CSS. It is currently in an early development stage, with the latest stable version being 0.1.0. While it is not fully spec-compliant, it is designed to parse all spec-compliant CSS loosely and efficiently, prioritizing graceful error recovery to handle malformed CSS in a manner similar to browsers. This makes it particularly suitable for scenarios requiring runtime manipulation, such as in tools like Polymer or Polymer Designer. The library ships with TypeScript types and focuses on providing a performant parsing and stringification mechanism, though it notably discards most insignificant whitespace during processing. Its release cadence appears to be iterative with frequent minor updates as indicated by the 0.0.x version progression.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install shady-css-parser"],"cli":null},"imports":["import { Parser } from 'shady-css-parser';","import { Stringifier } from 'shady-css-parser';","import { NodeFactory } from 'shady-css-parser';","import * as shadyCss from 'shady-css-parser';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Parser, Stringifier } from 'shady-css-parser';\n\nconst cssInput = `\n  body {\n    color: red;\n    font-size: 16px;\n    /* Custom property example */\n    --main-bg: blue;\n  }\n  .container {\n    padding: 10px;\n    border: 1px solid black;\n  }\n`;\n\n// Initialize the Parser and parse the CSS string into an Abstract Syntax Tree (AST).\nconst parser = new Parser();\nconst ast = parser.parse(cssInput);\n\nconsole.log('--- Parsed AST (truncated for brevity) ---');\nconsole.log(JSON.stringify(ast, null, 2).substring(0, 500) + '...\\n'); // Log a portion of the AST\n\n// Initialize the Stringifier and convert the AST back into a CSS string.\nconst stringifier = new Stringifier();\nconst outputCss = stringifier.stringify(ast);\n\nconsole.log('--- Stringified CSS ---');\nconsole.log(outputCss);\n\n/*\nOutput will be normalized, and most insignificant whitespace will be discarded.\nFor example:\nbody {color: red; font-size: 16px; --main-bg: blue;}\n.container {padding: 10px; border: 1px solid black;}\n*/","lang":"typescript","description":"Demonstrates the basic usage of Shady CSS Parser to parse a CSS string into an AST and then stringify the AST back into a normalized CSS string.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}