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
Move css-tag.js
from @lit/reactive-element
to lit-html
(or @lit/css
)
#4526
Comments
css-tag.js
from @lit/reactive-element
to lit-html
css-tag.js
from @lit/reactive-element
to lit-html
(or lit-css
)
The CSS tag utilities have no overlap with lit-html's responsibilities though. lit-html doesn't do anything with either CSS or shadow roots. |
@justinfagnani That makes sense. Perhaps the alternative I recommended of a new Update: Here's an example of an element that's not using |
css-tag.js
from @lit/reactive-element
to lit-html
(or lit-css
)css-tag.js
from @lit/reactive-element
to lit-html
(or @lit/css
)
That use seems great though. That module is not going to pull in anything else from reactive-element. The only thing that would be saved by a separate lit/css package is a couple kB of reactive element implementation on disk in node_modules/. |
I guess my issue is philosophical. One of my main goals of |
Do they have to know? Can you just re-export the |
They need to know, yes, because I'm declaring lit-html as a peerDependency to allow users to use whatever version works best for their project (currently works with lit-html v2 and v3 and can even be an alias for hyperHTML) and to support bundlers via npm and browsers via importmap. I could just copy css-tag.js into the project, but that feels far worse for users. |
Should this be an RFC?
Which package is this a feature request for?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
It would be nice to be able to import
{ adoptStyles, css }
fromlit-html
instead of@lit/reactive-element
for projects that use standalonelit-html
. This way elements that only want to importlit-html
can avoid having to include@lit/reactive-element
in their dependencies when all that's wanted is the css helpers.Current:
Proposed
Option 1:
Option 2:
I personally prefer option 1, but I understand the reasoning behind preferring option 2, similar to how directives are optionally imported.
Alternatives and Workarounds
Alternative
It might even be a good idea to create
@lit/html
and@lit/css
packages, but that might be RFC territory:Workaround
It's currently possible to use the css helpers by importing them from
@lit/reactive-element
, but it kinda breaks the mental model of standalone use oflit-html
.The text was updated successfully, but these errors were encountered: