Locomotive assets in production

I asked this question in google-groups locomotivecms, but have not yet received a useful answer. So try here. I have a feeling that the problem is not just a problem with rails, but somehow related to how the locomotivecms engine is implemented.

I installed the locomotivecms application according to the instructions here - http://doc.locomotivecms.com/guides/get-started/install-engine

The application works fine in development mode.

Then I precompiled the assets and started them in production mode ( bundle exec unicorn_rails -E production ). Now when I open the application in the browser, the stylesheets are not displayed. I checked the publication / assets and there is a fingerprint stylesheet requested by the browser. However, it does not display correctly. This shows the chrome view resources:

enter image description here

It looks like the stylesheet contains html. If I open it from the public / assets folder, it contains css. I think Lokomotiv intercepts the request and somehow does not return css. The open source locomotive, their code is on github - https://github.com/locomotivecms/engine .

+1
ruby-on-rails asset-pipeline locomotivecms
source share
1 answer

The problem was not with Locomotivecms, it was a rail thing that I did not know about. I had the following in production.rb:

config.serve_static_assets = false

This parameter is correct if you run your application in Nginx or Apache during production. In this case, they transfer public assets. But if you run your application on a simple rails server in production, for example, unicorn, webbrick, thin, etc., then you need to set this parameter to true so that the rails server can serve assets from the public folder. I set this to true, started the server ( bundle exec unicorn_rails -E production ), the assets were satisfied.

More information about config.serve_static_assets can be found here: http://guides.rubyonrails.org/configuring.html

+4
source share

All Articles