examples icon indicating copy to clipboard operation
examples copied to clipboard

Add with-svelte-injected-style example

Open JoacoEsteban opened this issue 1 year ago • 7 comments

JoacoEsteban avatar May 02 '24 15:05 JoacoEsteban

Ooh noice! I wonder if we should separate this into its own example, or couple it into the with-svelte :-?

louisgv avatar May 22 '24 18:05 louisgv

Hey! I made this draft to show a working example for the changes introduced on https://github.com/PlasmoHQ/plasmo/pull/955 to @avi12. I guess we could add it to with-svelte if you consider this to be the default behavior!

JoacoEsteban avatar May 22 '24 18:05 JoacoEsteban

IMO it should be in with-svelte Using Svelte's CSS injection renders Plasmo's getStyle useless

avi12 avatar May 22 '24 19:05 avi12

Awesome, then i'll add the changes to the with-svelte example and update the PR.

JoacoEsteban avatar May 23 '24 15:05 JoacoEsteban

Hey there! Just updated the PR with what we discussed. Let me know if you want to add/remove anything else.

JoacoEsteban avatar May 26 '24 22:05 JoacoEsteban

To be honest, it's a good practice to be able to use getStyle if you wish to apply CSS globally For example, in my extension I'm using it to switch between CSS variables related to dark and light modes, and the advantage is that I only need to edit in one file to affect every other component

avi12 avatar May 27 '24 05:05 avi12

I agree, that's why I left the getStyles call for plasmo container styling. I just moved the component styles into the component

JoacoEsteban avatar May 27 '24 09:05 JoacoEsteban