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

Dynamically inserted selectors loose their styles #46

Open
schwers opened this issue Oct 27, 2022 · 0 comments
Open

Dynamically inserted selectors loose their styles #46

schwers opened this issue Oct 27, 2022 · 0 comments

Comments

@schwers
Copy link

schwers commented Oct 27, 2022

I have a project using lit. In a design system our org makes there's code for sharing styles that when you pass in a selector to apply, returns a css template result. During minfication body's of a selector that gets injected dynamically are removed. I suspect this is might be due to the selector not existing in the template part so maybe its removed under the assumption that the selector wouldn't match anything?

e.g. I would expect

var minifyHtmlLiterals = require("minify-html-literals").minifyHTMLLiterals


minifyHtmlLiterals(`
  css\`
      foo {
        bar: baz;
      }

      \${unsafeCSS('#foo-id')} {
        bar: baz;
      }
  \`
`).code

to produce

'\n  css`foo{bar:baz}${unsafeCSS('#foo-id')}{bar: baz}`\n'

but instead i'm getting back

'\n  css`foo{bar:baz}${unsafeCSS('#foo-id')}`\n'
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

No branches or pull requests

1 participant