Pregunta

The problem is the following:

On the production website:

<link data-turbolinks-track="true" href="/assets/application-88627ba4e39c16e7875ecd7dacb14d52.css" media="all" rel="stylesheet">
<link data-turbolinks-track="true" href="/stylesheets/stylesheet.css" media="all" rel="stylesheet">

In application.css:

*= require_self
(no *= require_tree)

In index.html.haml:

= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= stylesheet_link_tag "stylesheet", media: "all", "data-turbolinks-track" => true

So the problem is: application.css is working properly, but I don't want it to include every other stylesheet. (I want different stylesheets per subdomain) So I need to include it in another stylesheet_link_tag, but that doesn't work properly. It isn't in the /assets directory and it doesn't have a fingerprint. In development, it does work.

How can I fix this? Thanks!

¿Fue útil?

Solución

You're probably missing your stylesheet from the precompiling targets. Add this to your config/application.rb:

config.assets.precompile += %w(stylesheet.css)

It works in development mode because default settings for this environment will serve assets in the application itself and will compile assets on demand without checking config.assets.precompile setting.

Otros consejos

In production.rb, make sure you have:

config.assets.precompile += ['stylesheet.css']

so that it gets compiled as well when you run bundle exec rake assets:precompile.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top