Cweili / svelte-fa

Tiny FontAwesome component for Svelte
https://cweili.github.io/svelte-fa/
MIT License
398 stars 24 forks source link

Removing inline styles #308

Closed marekdedic closed 8 months ago

marekdedic commented 9 months ago

I've made it so no inline styles will be produced, unless you add a <Fa style="..."> property - then you can't really be helped :D

Additionally, I've made it so the docs extract their CSS into a separate file, I mainly did it because I used the docs to test the thing (and you need CSS in <head> or a separate file to not trigger CSP), but it should improve performance, so I left it in the PR...

Cweili commented 8 months ago

Thanks!

marekdedic commented 8 months ago

Hi, sorry to bother, but could you please release this change? Thanks!

Cweili commented 8 months ago

@marekdedic I apologize for taking so long to reply to you.

I noticed that making this change would cause the package to lose one of its features, "No CSS file required."

Can we use a solution similar to ".style.background = 'red';" to solve the CSP issue?

marekdedic commented 8 months ago

Hi, what do you mean by that? You can still use this package without a separate CSS file (CSP won't work for you then, but that's kind of the point of it :D). I re-configured the docs to extract the CSS here, but the users don't have to do this (they can decide)...

Cweili commented 7 months ago

The solution similar to https://stackoverflow.com/a/57633533. Which you mentioned in this comment, does not require extracting the CSS. Extracting CSS files requires users to have additional build configurations to load these CSS files.

marekdedic commented 7 months ago

The current solution also doesn't require extracting the CSS - it's up to the user. If they want to keep the CSS as part of the JS, they can (they won't be able to have strict CSP, but that's kind of the point of strict CSP...).

Cweili commented 7 months ago

Sure, I think we can release this together with this PR. It will be a BREAKING CHANGE.

Cweili commented 7 months ago

Released with v4. Thanks!