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 globalImport #662

Closed
wants to merge 4 commits into from

Conversation

graup
Copy link
Collaborator

@graup graup commented Apr 21, 2022

Based on the discussion at #600

The rule format mirrors the CSS spec: https://developer.mozilla.org/en-US/docs/Web/CSS/@import

@changeset-bot
Copy link

changeset-bot bot commented Apr 21, 2022

🦋 Changeset detected

Latest commit: 1bfb96a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@vanilla-extract/css Minor
@fixtures/features Patch
@fixtures/low-level Patch
@fixtures/recipes Patch
@fixtures/sprinkles Patch
@fixtures/themed Patch
@fixtures/unused-modules Patch
vanilla-extract-example-webpack-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mattcompiles
Copy link
Contributor

Couple of concerns with adding an @import API:

  • You can use it to import other local CSS files which most bundlers will try to interpret. This leads to scenarios that will break as relative imports will not work currently. If we merge Use realistic file paths in file scopes #647 this scenario may be able to be improved but not sure it'd ever be a good idea anyway.
  • In what scenario is using CSS import an ideal solution? As mentioned in the linked discussion, using CSS import leads to request waterfalls. Why wouldn't I just add the assets directly to the HTML?

@graup
Copy link
Collaborator Author

graup commented May 1, 2022

  • Yeah I'm also a bit concerned about local imports. That's a can of worms we likely don't want to open.
  • If you link to the woff2 files directly, I believe that has a couple disadvantages: I suspect Google is doing some magic to only deliver the file types needed for the user's browser. Also if they ever update the rules or move the files, you'll miss out on that.

The better workaround is importing the CSS using a <link> tag. That is fine, we just have to tell our consumers to do that.

So yeah, this is not a must-have feature.

@graup
Copy link
Collaborator Author

graup commented Feb 27, 2023

Since there hasn't been additional interest in this feature, I'm gonna close my PR!

@graup graup closed this Feb 27, 2023
@SalahAdDin
Copy link

It would be a great feature man @graup !

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.

3 participants