Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add a preprocess step to the plugin API #399

Open
c1rrus opened this issue Dec 20, 2024 · 0 comments
Open

Feature request: Add a preprocess step to the plugin API #399

c1rrus opened this issue Dec 20, 2024 · 0 comments

Comments

@c1rrus
Copy link

c1rrus commented Dec 20, 2024

I've been reading the Terazzo plugin API docs to figure out how to migrate some custom Cobalt plugins I made for our design system at work, Most of my plugins pre-process the design token data before it gets handed to a "normal" plugin to be output as CSS, JS, or whatever.

With Cobalt I used a hacky approach where you can pass one plugin into the config of my plugin. My plugin manipulates the parsed token data in some way and then runs the plugin specified in the config with that modfied token data. I suspect Cobalt's plugin API wasn't intended to be (ab)used in that way, but it worked :-)

I don't think Terrazo's new 2-step proces would let me do that. What I'm after isn't a transform() step to generate values to later be output. I want to modfiy the tokens data before it gets passed into transform().

Maybe there could be a preProcess() hook or something like that? It could take the same read-only tokens data and return a new tokens data that replaces it and is used later on.

Not quite sure how this would work with the AST stuff (I don't really have any experience of that), so I'm sure this proposal will require more thought and refinement. But hopefully, you get what I'm after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant