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

Passing variables into stylesheet via _render method results in comment #66

Closed
ztzven opened this issue May 17, 2018 · 2 comments
Closed

Comments

@ztzven
Copy link

ztzven commented May 17, 2018

Using https://stackblitz.com/edit/lit-element-example-zzo6gh as an example, inspect The color variable is a comment rather than the expected color.

Odd. Is lit-element broken? Or can you not use variables inside component stylesheets?

@ztzven ztzven changed the title Passing in css variables via _render method results in comment Passing variables into stylesheet via _render method results in comment May 17, 2018
@Lodin
Copy link

Lodin commented May 17, 2018

It would work if you add the following code:

import {unsafeHTML} from 'lit-html/lib/unsafe-html';

...

html`
${unsafeHTML(`<style> .mood { color: ${color}; } </style>`)}
...
`

It is not an issue of lit-element, it's about how lit-html works. I don't know exact issue, but take a look at the issue list there

@TimvdLippe
Copy link
Contributor

This is a duplicate of lit/lit#218 which has an open PR at lit/lit#274

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

3 participants