Reputation: 2918
Precompiling assets on the production server is very slow. So I have decided to recompile them on the development machine and upload assets to the Amazon S3 by jammit
. Everything's done but I have some negative problems:
public/assets
directory to git
control. Because if public/assets
directory is empty on the production server failsapplication.js
includes in the HTML as compressed and that way I have duplicated js code. Changing js doesn't make any effect because precompiled application.js
interrupts this code.That way my development process includes following steps:
jammit-s3
My questions are:
application.js
if I have it in public/assets
directory?public/assets
directory? Assets will only be on the S3 server.Upvotes: 1
Views: 5456
Reputation: 2918
I resolved this problem by including assets dir in gitignore and exclude only one file - public/assets/manifest.yml
and production server works correctly now, i.e. config.action_controller.asset_host = "http://assets.example.com"
works. It requires only manifest.yml
file
Upvotes: 1
Reputation: 1130
For question one I don't know a permanent solution other than running:
bundle exec rake assets:clean
before you switch back to development mode. I'd be interested to see if you can just ignore the assets in development without turning the entire assets pipeline off.
In production.rb there is an option for your second question:
# Enable serving of images, stylesheets, and JavaScripts from an asset server
config.action_controller.asset_host = "http://assets.example.com"
It should then ignore your assets directory since it relies on the remote host. Hope that helps.
Upvotes: 2