I create mousemade pixel perfection stuffs for the interwebs.

Published: 6 years ago

Deploying Rails to Openshift – Asset Pipeline Problems

I chose to go with Openshift for a new RoR project. Everything was smooth, until I started to commit and push frequently.

Following assets would not compile.

  • vendor/custom.modernizr (from Foundation framework)
  • custom stylesheet_link_tag and javascript_link_tag

I finally found that I have to add them to compile.assets.precompile in applicaiton.rb, as followed:

# Apart from regular stylesheet_include_tag 'application',
# I was also using stylesheet_include_tag 'admin'
config.assets.precompile += ['admin.css', 'admin.js']

Basically, we add all manifest files except default application.css/js files to precompiled assets array.

For vendor/custom.modernizr, I couldn’t find a solution. So I took the easy root, downloaded the file from their repo, and placed it in app/assets/javascripts. Then included it with

javascript_include_tag 'custom.modernizr'

. Of course, I added custom.modernizr to precompiled assets array.

config.assets.precompile += ['admin.css', 'admin.js', 'custom.modernizr']

I think there should be a better way to do this. But for now, it works.

Leave a Reply

Some HTML is OK