Bart Veneman
Bart Veneman
Related: https://github.com/csstree/csstree/issues/174
Work in progress for reading declared and comsumed container names: https://stackblitz.com/edit/stackblitz-starters-umuh7n?file=index.js,csstree-fork.js Using Svelte's fork stuff to parse container queries.
CSSTree 2.3.1 does not yet parse `layer()` or `layer` in `@import` yet. https://stackblitz.com/edit/node-28ttpj?file=index.js,package.json But the syntax explorer shows that it should work... https://csstree.github.io/docs/syntax/#AtrulePrelude:import
Example `@import` parsing in Svelte: https://github.com/sveltejs/svelte/blob/15bef57aecc3006b6aa88425a6f3b72b304b61cd/packages/svelte/src/compiler/parse/read/css-tree-cq/css_tree_parse.js#L26-L93 using CSSTree's `fork()` syntax.
WIP as copied from the Svelte PR: https://stackblitz.com/edit/stackblitz-starters-umuh7n?file=index.js,csstree-fork.js,nodes%2Fcontainer-query.js,nodes%2Fquery-css-function.js,nodes%2Fquery-feature-range.js
Related to https://github.com/projectwallace/css-analyzer/issues/321 because of our whacky `font` destructuring algorithm.
Example from exaprint.fr: ```css font: Styrene A,sans-serif; ``` produces a `font-size` -> `Styrene` and a `fontFamily` -> `A,sans-serif`
from cssday.nl ```css font: 100% source code pro, inconsolata, menlo, monospace ``` reports as `font-size: code`
See Twitter thread here https://twitter.com/csstree/status/1632496974921342976 > See “Syntax matching” in usage section of readme [https://github.com/csstree/csstree#usage](https://t.co/UtR03Iysg2) It also should work with string values beside of AST nodes.
Using CSSTree's syntax matching to destructure a font shorthand: ```js import * as csstree from 'css-tree' let fonts = [ '1em / 2px sans-serif, "Test me"', '100% Source Code Pro,...