Skip to content

Confused about how to best work with external style sheets and get styles updating on save? #4043

Answered by augustjk
benfrain asked this question in Q&A
Discussion options

You must be logged in to vote

The ?inline import for Vite provides a string as the default export so you'd want to pass that string directly into the unsafeCSS() call. If you do an array, it'll try to turn it into a string which means it'll get joined with a comma separator between them.

So either

static styles = [css`${unsafeCSS(reset)}`, css`${unsafeCSS(styleImport)}`];

or

static styles = css`${unsafeCSS([reset, styleImport].join(''))}`;

would be cleaner, I think.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@benfrain
Comment options

@augustjk
Comment options

Answer selected by benfrain
@benfrain
Comment options

@redfox-mx
Comment options

@benfrain
Comment options

@redfox-mx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants