Replies: 9 comments 4 replies
-
Hi, Anyone has a possible workaround to resolve this? Thank you |
Beta Was this translation helpful? Give feedback.
-
Since calling async function seems impossible in tailwind plugin context, I tried to call the async function in a synchronized way. My workaround is to put all the async functions in a You can view this plugin for more details https://github.com/InfiniteXyy/tailwindcss-iconify/blob/main/src/index.ts#L22 Though it seems a little bit strange, it works well in my situation. I also tried |
Beta Was this translation helpful? Give feedback.
-
This would be an excellent quality of life improvement. For example, fetching resources or using the promise based Node-API etc. Also @InfiniteXyy I've just made the same Tailwind CSS plugin tailwindcss-plugin-icons 😆 |
Beta Was this translation helpful? Give feedback.
-
Hey! I got into a place where I needed to dynamic |
Beta Was this translation helpful? Give feedback.
-
Any chance of getting this? |
Beta Was this translation helpful? Give feedback.
-
I need this! it would be so handy. Use case: Fetch web font paths and formats for a plugin, where I add Would be amazing if this could work! |
Beta Was this translation helpful? Give feedback.
-
bump, needing this to fetch user selected colors |
Beta Was this translation helpful? Give feedback.
-
Asynchronous logic is not supported still now, I just don't believe. ref: #11672 |
Beta Was this translation helpful? Give feedback.
-
Just a small update, but there is currently #14132 that adds support for async plugins, abeit only in v4. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm writing a plugin that fetches an external CSS file, objectifies it, and adds to Tailwind layers.
It looks something like this:
However, the new base styles and utilities are not added correctly, and sometimes Tailwind will throw error about missing styles.
I dig a little into the code and see the the plugins defined in
plugins
config are executed sequentially. For async plugins like above, it means that theaddBase
,addUtilities
, ... etc may not be called by the time Tailwind finishes initialization.Would you mind considering
await
such async plugins?Note: I could use
fs.readFileSync
in my plugin to avoid making my function async, but I want my config file to play nice with Play CDN, hencefetch
.Beta Was this translation helpful? Give feedback.
All reactions