vite_ruby icon indicating copy to clipboard operation
vite_ruby copied to clipboard

fix: add crossorigin attribute to style tag

Open zangab opened this issue 8 months ago • 2 comments

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 https://github.com/ElMassimo/vite_ruby/issues/528

Screenshots 📷

zangab avatar Apr 17 '25 21:04 zangab

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.

zangab avatar Apr 22 '25 08:04 zangab

Is there any news on this?

23tux avatar Oct 23 '25 12:10 23tux