Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add css support! #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add css support! #2

wants to merge 1 commit into from

Conversation

MuhsinFatih
Copy link

This PR adds custom css for components. It is scoped to component like in regular svelte components. The components in the example are each updated to have their own custom styles.

Here is the end result:
image

css: css => { css.write('dist/bundle.css'); }
}),
svelte({ customElement: false, exclude: /\.wc\.svelte$/,
css: css => { css.write('dist/bundle.css'); }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I just noticed that this one is overwriting the bundle.css file generated per line 18. I don't know how to merge these styles

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if I don't want to emit css file? we want to inline the styles in the style tag

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great but I don't know how that can be done. This is sort of a hack I think. I'm only vaguely familiar with custom elements

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a kind of hack here: https://github.com/redradix/svelte-custom-element-template

But seems to be challenging to upgrade to the latest svelte loader...

If you find a way, I will be more than happy to use it 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants