Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Refactor from custom tuple format to PostCSS nodes #8

Merged
merged 5 commits into from
Mar 5, 2021

Conversation

adamwathan
Copy link
Member

This PR refactors everything to stop using our little rule tuple syntax and instead just use full PostCSS nodes everywhere. The simple format sounded nice at first but there are lots of things it doesn't handle (like comments, or even @font-face rules) and it was starting to become apparent why PostCSS nodes are in the format they are 👀

There were also many places in the code where we were starting with PostCSS, converting it to a tuple because that's what some other code expected, only to inevitably convert it back to PostCSS.

I still need to update all of the plugins to return PostCSS nodes directly, but for now there's a small layer in between to turn them into PostCSS nodes before they make contact with the rest of the system, so this is safe to merge as-is. I need to decide on the API for on-demand plugins and then I'll rework each one to return PostCSS nodes.

for (let result of plugin(modifier, pluginHelpers)) {
if (Array.isArray(result)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the little adapter layer, we can remove these conditionals when the plugins are refactored.

@adamwathan adamwathan force-pushed the refactor-to-postcss branch from e73604f to 217b1ed Compare March 5, 2021 20:34
@adamwathan adamwathan merged commit f7129d5 into master Mar 5, 2021
@adamwathan adamwathan deleted the refactor-to-postcss branch March 5, 2021 21:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant