stealjs / steal-css

StealJS plugin for CSS
https://www.npmjs.com/package/steal-css
MIT License
2 stars 1 forks source link

In optimized build, links are injected multiple times #64

Closed matthewp closed 6 years ago

matthewp commented 7 years ago

Because the optimizer doesn't resolve to URLs, the check to see if a <link> already exists in the page will always be falsey. The fix is to use either URL() or <a> to get the href relative to the page, and use that as the check.

m-mujica commented 6 years ago

I'm seeing this in bitballs

screen shot 2018-01-24 at 10 07 12 am

doing some debugging, it happens b/c document.styleSheets comes out empty each time the css slim plugin is called (even tho there are links already on the header, not sure why)

screen shot 2018-01-24 at 10 08 55 am

Was able to replicate in Safari but not Firefox (guessing that's why the tests didn't caught it)