Skip to content

fix: add crossorigin attribute to style tag#544

Merged
ElMassimo merged 2 commits intoElMassimo:mainfrom
zangab:bugfix/crossorigin-attribute
Mar 17, 2026
Merged

fix: add crossorigin attribute to style tag#544
ElMassimo merged 2 commits intoElMassimo:mainfrom
zangab:bugfix/crossorigin-attribute

Conversation

@zangab
Copy link
Contributor

@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
Contributor 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.

@23tux
Copy link

23tux commented Oct 23, 2025

Is there any news on this?

@ElMassimo ElMassimo merged commit d57495e into ElMassimo:main Mar 17, 2026
17 checks passed
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

3 participants