Skip to content

Can async resolvers be used in Twind presets? #439

Answered by sastan
tmikaeld asked this question in Q&A
Discussion options

You must be logged in to vote

You are right. Twind rules must be sync. This is because twind main focus is to inject the style on class attribute changes. And these need to be sync. This is mostly not a problem except for a use case like fetching a icon source. On discord there was a question a few days ago: https://discord.com/channels/798324011980423188/929266391645839360/1064957388190404658

An idea is to use the icon url directly instead of fetching the source and inline it. The downside would be no automatic rendering mode. That could be fixed by a theme/preset setting or providing the mode within the class name like ?bg for background-img and ?mask for mask.

I really like the idea of having such a preset but I'm …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tmikaeld
Comment options

Answer selected by tmikaeld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants