문제

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!

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top