LogicLooking
LogicLooking

Reputation: 928

Can I use different style sheets in ember?

I would like to use one app, but state that in view A, use style sheet bla, and in view B use style sheet other. How could I achieve this using ember - or is this possible?

Upvotes: 1

Views: 176

Answers (1)

Luke Melia
Luke Melia

Reputation: 8389

You could use the didInsertElement hook of the view to dynamically load a stylesheet and willDestroyElement to unload a stylesheet. There are a number of SO questions/answers describing how to do the loading/unloading, which is not Ember-specific.

Timing may be a little tricky because loading stylesheets is asynchronous, and will take time depending on server response time, latency, etc.

In most cases, it isn't worth the trouble to do this, but of course when you need to, you need to...

See the docs for Ember.View for more information about the lifecycle hooks I mentioned: http://emberjs.com/api/classes/Ember.View.html#event_didInsertElement

Upvotes: 1

Related Questions