pierred69
pierred69

Reputation: 59

Ember 2.4 change main view css class

I'm looking for a way to change the css classname of the root element of an Ember app in Ember 2.4.

The old way doesn't work anymore because of deprecation, and now I have :

<body class="ember-application">
   <div id="ember414" class="ember-view">
     <!-- THE WHOLE APP -->
   </div>
</body>

I'm looking for making something like :

<body class="ember-application">
   <div id="ember414" class="ember-view theCssClass">
     <!-- THE WHOLE APP -->
   </div>
</body>

Thanks a lot for your help !

Upvotes: 2

Views: 214

Answers (2)

stijn.aerts
stijn.aerts

Reputation: 6206

Possible solutions:

Css selector '.ember-view:first-of-type' or 'body'.

You could also insert a wrapper in your application.hbs file:

<div class="your-style">
  <!-- Other content -->
  {{outlet}}
</div>

Pretty sure this works.

Upvotes: 0

Fear not, the deprecated functionality is still available as ember-legacy-views.

ember install ember-legacy-views
ember g view application

Then add your class to the generated view:

classNames: ['woot']

PS This might change when Ember introduces routable components.

Upvotes: 2

Related Questions