tricknotes / ember-cli-rails

Unify your EmberCLI and Rails Workflows
http://thoughtbot.github.io/ember-cli-rails/
MIT License
713 stars 205 forks source link

How to work with CSS/SASS? #434

Closed andrewhavens closed 8 years ago

andrewhavens commented 8 years ago

I am setting up my ember-cli app with the SASS plugin and am running into an issue regarding the assets directory. The Rails assets path is overriding the ember-cli assets path. I noticed that the readme does not mention how you are supposed to handle CSS assets. Are they meant to be managed in the Rails app or the Ember app?

seanpdoyle commented 8 years ago

Thanks for opening this issue, @andrewhavens.

Technically, you can keep your CSS and SCSS anywhere you'd like: in your server code or in your Ember client code.

If you'd like to have styles from each, you could override the view:

<%= render_ember_app :frontend do |head| %>
  <% head.append do %>
    <%= stylesheet_link_tag "my-rails-generated-styles" %>
    <%= csrf_meta_tags %>
  <% end %>
<% end %>

This snippet demonstrates injecting a <link> tag from your server into your EmberCLI-generated index.html.

There is nothing technically limiting the sharing of CSS code between your client and your server, although picking one or the other might make sense from an organizational perspective.

The only thing that isn't currently possible is sharing SCSS code.

Serving the already compiled CSS is no issue, but you can't share and precompile SCSS code that is split between repositories.

andrewhavens commented 8 years ago

Thanks for the response @seanpdoyle. Not sure what I did, but all of a sudden, my SASS code started working in my Ember app. 👻