Last updated

CSS parsing, validation and serialization

const css = require("std/css");console.log(css.parse("a { color: red; }").rules.length); // 1console.log(css.stringify(css.parse("a { color: red; }"))); // "a {\n  color: red;\n}\n"console.log(css.validate("a { color: red; bogus: 1; }"));// [{property: "bogus", valid: false, errors: [...]}] ([] when clean)

🔗css.parse

css.parse(text) -> {rules: [...]}

const css = require("std/css");css.parse("example");

🔗css.stringify

css.stringify({rules: [...]}) -> string

const css = require("std/css");css.stringify("example");

🔗css.validate

css.validate(text) -> problems per declaration ([] when clean)

const css = require("std/css");css.validate("example");