linkedin / css-blocks

High performance, maintainable stylesheets.
http://css-blocks.com/
BSD 2-Clause "Simplified" License
6.33k stars 152 forks source link

Block definition compiler #454

Closed chriseppstein closed 4 years ago

chriseppstein commented 4 years ago

This PR gets the basics of block definition compilation working. Two aspects of block definition files are omitted from this PR (inherited-styles and conflict resolutions). These aspects are important for pre-compilation but don't block our current project.

In this PR I introduce a CSS-Blocks specific AST that describes both legal CSS Block files as well as legal Block Definition Files. I use this AST first to construct a partial CSS Block AST during block parsing this is then "mapped" to a definition AST during block compilation. The rest of the AST is built up by examining the Block data model. Once the block definition AST is constructed I use an AST visitor to create the postcss AST which is then stringified.