vanilla-extract
vanilla-extract copied to clipboard
:sparkles: add option to inline/load css to style element for esbuild plugin
In some environments and use cases (eg Figma plugins) you can't load external resources with relative paths so you either have to host CSS separately on a remote server or inline it in the JS/HTML so this PR adds a new option useStyleLoader
to @vanilla-extract/esbuild-plugin
that allows you to skip CSS loader and inject the CSS using style element in the current document, by emitting a JS file with the code to do that similar to (style-loader)
⚠️ No Changeset found
Latest commit: 3beb1a3c0376b2a43b8a7658c6c94ceb90aa67ac
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
I'm not sure this should be an option of VE, it's a very specific use case. Isn't it possible to configure esbuild (maybe with a plugin) so that it transforms the css loader result into this kind of style loader?
I'm not sure this should be an option of VE, it's a very specific use case. Isn't it possible to configure esbuild (maybe with a plugin) so that it transforms the css loader result into this kind of style loader?
@graup I tried to get it working as a separate plugin but it didn't work, I either have to create the VE plugin again or add the support to the existing one, I think it could be because VE css files are virtual and they got intercepted first by vanilla-extract and handed to the css loader directly which I can't intercept
Can you release a version. thk
Can you release a version. thk
@yaojiu19 I'm not sure if this PR is ready to test, or is even something we want to still pursue.
@salamaashoush Any updates?
I can rebase and update the MR if you want to test and merge it, currently i copied the plugin into my project repository and using it
I can rebase and update the MR if you want to test and merge it, currently i copied the plugin into my project repository and using it
yeah, manually import css files is inconvenient in monorepo‘s project