Skip to content

Conversation

zangab
Copy link

@zangab zangab commented Apr 17, 2025

Description 📖

This pull request adds the crossorigin attribute to styles injected via the vite_javascript_tag.

Background 📜

Vite adds the crossorigin to styles tags by default, see code in Vite.

The Fix 🔨

Vite adds a default crossOrigin = '' attribute to stylesheets. Therefore, this gem should also add the crossorigin to the stylesheet_link_tag options. In addition, the default value of "anonymous" changes to "" which has the identical meaning according to MDN Docs so the default value is the same as in Vite.
Fixes #528

Screenshots 📷

@zangab zangab force-pushed the bugfix/crossorigin-attribute branch from c3de697 to ad3c82c Compare April 22, 2025 08:35
@zangab
Copy link
Author

zangab commented Apr 22, 2025

The PR was updated to also change the crossorigin default value from "anonymous" to an empty string "". This means the same, see MDN Docs. However, Vite also uses an empty string for the crossorigin so these values should match.

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.

Crossorigin attribue for stylesheets
1 participant