-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Feature request: API to load external styles imperatively #3123
Comments
Your example works if you enable shadow DOM. Looks like a dup of #2681 |
Forgot to mention that you need to create a |
@zoechi thanks for the shout-out. AFAIK, My jsbin doesn't work (under both shadow and shady) because the shimming is done during element registration time. There are possible workarounds:
but both approaches feel clunky. Since Thanks so much for your input! |
That might be, but for me using |
Hmm... not sure why either... In any case, I hope the imperative loading of styles is a feature that more Thanks again. On Tue, Dec 8, 2015 at 6:23 PM, Günter Zöchbauer notifications@github.com
|
Me too would like to have such a feature in future releases... |
This feature would be useful for us too, |
+1 |
@zerodevx There is a related snippet in the Polymer styling docs, though it is specific to "local" DOM. <script>
Polymer({
is: 'x-custom',
changeTheme: function() {
this.customStyle['--my-toolbar-color'] = 'blue';
this.updateStyles();
}
});
</script> |
@kevinSuttle that isn't loading external styles. |
+1 |
1 similar comment
+1 |
Moving to 2.0 since shadow dom v1 supports stylesheets. We should support this. |
+1 |
This is really a This |
I hate to say it, but could this be made to be performant if there was virtual CSSOM diffing in memory? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen! |
Hello. I'm not sure if there's an existing API for this. The task is to selectively load external stylesheets during runtime; the use case is to allow setting a custom element's theme declaratively (among some others I can think of).
For example, I can do
<x-test>
can then selectively load the styles (among 100's of theme selections) to apply.Currently the pattern for loading external styles uses
style-modules
. However, one cannot simply do a.importHref("my-styles.html")
, create a<style include="my-styles"
> node and push it into local DOM.Jsbin: http://jsbin.com/gemitewumi/edit?html,output
So I was wondering is this a bug, a feature that could be added, or there's a better way to handle this?
Thanks so much.
The text was updated successfully, but these errors were encountered: