Parsing a CSS file (if possible with nesting, variables) into a normalized file I can work with #1635
-
I would like to transform a CSS file that uses CSS nesting and possibly CSS custom properties (variables) into a simplified AST without nesting and variable, and with selectors parsed into an AST as well. For instance, take the following CSS:
I would like to parse it into simplified set of rules that could look like this if rendered as CSS:
I would need that in an AST format I can work with using JavaScript, with selectors parsed into AST Nodes too:
This Javascript object is what I would need. Is it possible to achieve this with PostCSS? Can anyone point me to an example or the right resources? The API and the set of plugins available is too large and I couldn't find what I need. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If I understand you correctly, you can do it with You can use |
Beta Was this translation helpful? Give feedback.
If I understand you correctly, you can do it with
postcss-nested
andpostcss-custom-vairables
.You can use
postcss-cli
, create PostCSS config (see plugin docs) and process CSS.