feat(TemplateLoader): cssUrl#580
Conversation
I noticed this feature but didn’t work so I went ahead and implemented it. The only problem I have atm is the createTemplateWithCss helper method that should be in dom or just in closure scope. I also need some tests after your feedback about where to put the helper createTemplateWithCss.
|
👍 |
|
There were no final, written conclusion from the discussion on a similar PR. But I was under the impression that CSS urls don't really belong to TemplateConfig and should rather be parsed out from the template itself. //cc: @mhevery |
|
it looks like I did what Miško suggested by inserting <style> inside the people in react world would use the inline style attribute or in ng1 its ng-style so I could just use that with a style Decorator |
|
@gdi2290 depends on how you understand "template": on a IMO conceptually CSS should be tied to HTML of a template and not a component's JS and this is how I'm interpreting comments in the issue I've linked to. |
|
I agree css should be in html but then again a few years back someone could say that about javascript in html. Facebook/React/Pete Hunt are pushing for css to be managed js and explains all the benefits from doing so. One hack Famo.us, with the angular adapter, had to do was providing callbacks in js for css classes in order to manage css correctly. Knowing that I'm personally on the side of css being managed by js |
|
The obvious downside being that one can't simply swap a template + CSS for a given component, which is pretty bad IMO. Anyway, let's see what others got to say... |
|
I added my style decorator for more feedback on how people should handle styles in ng2 #583 |
|
@gdi2290 I love your enthusiasm! Could you check with me on features to make sure we don't dulpicate effort? As it stands right now we have chose to put |
|
I am going to close this as we are not planning to solve this in this way. We will certainly revisit if we change our mind. |
|
no worries, it was a great exercise getting it to work correctly |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I noticed this feature in the docs but didn't work so I went ahead and implemented
it. The only problem I have atm is the createTemplateWithCss helper
method that should be either in
domor just in closure scope. I also need sometests after your feedback about where to put the helper
createTemplateWithCss
Edit: I could use inline styles below