JSPM

@filbert-js/css-ast

0.0.8
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 699
  • Score
    100M100P100Q101238F
  • License MIT

Package Exports

  • @filbert-js/css-ast

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@filbert-js/css-ast) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@filbert-js/css-ast

CSS to AST transformer for filbert-js.

Install

yarn add @filbert-js/css-ast
import { toAST } from '@filbert-js/css-ast';

const css = `
color: gray;
button {
    margin: 0 1rem;
    background: #1f368f;
    color: white;
    span {
        color: red;
    }
}
button,span {
    color: pink;
}
`;
const ast = toAST(css);
console.log(ast);
/**  
children: Array[2]
    0: Node
    1: Node
rules: Array[1]
    0: Object
name: "color"
value: "gray"
start: 0
end: 168
raw: "
  color: gray;
  button {
    margin: 0 1rem;
    background: #1f368f;
    color: white;
    span {
      color: red;
    }
  }
  button,
  span {
    color: pink;
  }
"
* */

More documentation is available at https://filbert-js.vercel.app.