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

✨ add option to inline/load css to style element for esbuild plugin #1150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

salamaashoush
Copy link

@salamaashoush salamaashoush commented Jul 25, 2023

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)

@changeset-bot
Copy link

changeset-bot bot commented Jul 25, 2023

⚠️ No Changeset found

Latest commit: 3beb1a3

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

@salamaashoush salamaashoush changed the title ✨ inline/load css to style element ✨ add option to inline/load css to style element for esbuild plugin Jul 25, 2023
@graup
Copy link
Collaborator

graup commented Jul 26, 2023

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?

@salamaashoush
Copy link
Author

salamaashoush commented Jul 26, 2023

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

@yaojiu19
Copy link

yaojiu19 commented Dec 5, 2023

Can you release a version. thk

@askoufis
Copy link
Contributor

askoufis commented Dec 6, 2023

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?

@salamaashoush
Copy link
Author

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

@yaojiu19
Copy link

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

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

Successfully merging this pull request may close these issues.

4 participants