-
Notifications
You must be signed in to change notification settings - Fork 73
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
Why not use a regular CSS file? #88
Comments
Here is a very detailed answer, because the problem is actually very complicated. First, the "use an external stylesheet" bit:
Now that we know we have to use a
TL; DR: we couldn't use an external stylesheet, so maintaining one is not feasible for the Polymer elements team :) Hope this clears things up! |
@notwaldorf Can you point me to a resource that explains why this is a security risk? This is is a huge obstacle when you already have a nice UI library written and neatly organized in BEM blocks but have to either: a. Create a tool that wrap each BEM block in a |
I still don't understand why this can be a security risk but I found another answer which makes sense.
That means scoped styles goes out the window and I can understand why that is bad for a web component. So for now, we will go with option a. PS. Any idea why the implementation of shady DOM result in a bad case of classitis? It seems like a poor design choice. |
paging @sorvell who knows the details, but my understanding is that it would lead to parsing the external css file as an html document, which isn't great (and since you're expecting css and getting html, and maybe js since nobody is stopping you, this could be unsafe). |
Ah, you mean if we use HTML imports natively in the browser, which can not be restricted to only import CSS. At first glance that seems no different from importing a Web Component which could contain malicious code but we do it anyway. Anyway, looking forward to @sorvell answer. Thanks for your speedy reply. |
@dotnetCarpenter @sorvell @notwaldorf This issue seems very actual for me. I would like to use some webcomponents in an existing bootstrap project.
With a
|
Same question as @profhase and a little question is with some front end UI libraries contain both css and js such as Bootstrap and Semantic, How can i include its js parts?
This will soon deprecate as mentioned at https://www.polymer-project.org/2.0/docs/devguide/style-shadow-dom#style-modules . When it deprecated do we copy all content of css libray into module like this ?
|
We aren't using any CSS variables or CSS Mixins here. And the https://github.com/PolymerElements/iron-flex-layout/blob/master/iron-flex-layout-classes.html contains no Polymer specific syntax except for the
<style>s
to be wrapped inside<dom-module>
s.Why not just take it out in a regular CSS file? Not only will it be a great boon for non-Polymer projects (greater interops will lead to greater contributions, in my opinion), but also the syntax becomes cleaner in Polymer Projects. No more
The text was updated successfully, but these errors were encountered: