Skip to content

fix: add crossorigin attribute to style tag #544

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

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

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