-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support more variants of css inside lit components #47
Comments
@43081j Hello, what do you think about this? |
It's a difficult one to solve as it means we need to start parsing html/SVG templates in lit components just in case they contain CSS. These days I would hope everyone uses stylesheets instead. Do you have an example of why someone would want inline CSS instead of writing it in a style template? It's a fair chunk of work so if we can instead just tell people to use CSS templates, it'll save a lot of effort |
So, I'll try to describe my case: My project uses hundreds of lit components, some of them were created long time ago, some of them - not.
html`
<h1 style="color: green"> ... </h1>
` I fully agree that it's not a good practice. Above I mentioned this case as minor one, it's not really critical - on my project only couple of places have this in some legacy code. In case if it's possible to support such cases without big efforts (we'll try to parse
So,
So, even in case if it would be needed in the future to re-write everything to |
@43081j Hello, what do you think about described above? |
it would introduce a fair amount of overhead in the syntax parsing to support the ideally you would migrate to style templates, for the various benefits of adopted stylesheets (e.g. the fact that an adopted stylesheet can be shared across many instances of an element, while style tags will be duplicated). though i understand such a migration takes a lot of time, if you even have the chance to do it (or want to do it). we could possibly put its difficult, as i know it would help you and some others a lot but its an expensive piece of work (time consuming). we'd have to implement html template extraction, using parse5 to parse the templates and meanwhile replacing interpolations with placeholder html. basically what eslint-plugin-lit does under the hood. its a lot of logic to introduce for a user case people should be moving away from |
Yep, this may take some time to do this. We already have own |
Now, the plugin works with css places inside
css
tag. However, css may often be stored near htmlExample 1 (
html
tag):Example 2 (
svg
tag):There are also some minor cases when some styles are inlined:
The proposal is to at least add support of first 2 major cases (Example 1, 2), however, would be nice to support all possible variants.
The text was updated successfully, but these errors were encountered: