In rails 3.1, when you precompile the assets, rails create public/assets directory and add files there.
Do you version开发者_如何学运维-control public/assets/*?
I use Capistrano to deploy. The last step is compiling the assets. Nothing like that gets checked into version control.
https://github.com/capistrano/capistrano/wiki/Documentation-v2.x
Checking in compiled assets, .gz files/etc, will just clutter up version control.
I was looking for an answer to this too. I found the official Rails Guide has some thoughts on this:
http://guides.rubyonrails.org/asset_pipeline.html#local-precompilation
Here's a quote of the relevant section (emphasis added):
There are several reasons why you might want to precompile your assets locally. Among them are:
- You may not have write access to your production file system.
- You may be deploying to more than one server, and want to avoid duplication of work.
- You may be doing frequent deploys that do not include asset changes.
Local compilation allows you to commit the compiled files into source control, and deploy as normal.
There are three caveats:
- You must not run the Capistrano deployment task that precompiles assets.
- You must ensure any necessary compressors or minifiers are available on your development system.
- You must change the following application configuration setting:
In
config/environments/development.rb
, place the following line:config.assets.prefix = "/dev-assets"
The
prefix
change makes Sprockets use a different URL for serving assets in development mode, and pass all requests to Sprockets. The prefix is still set to/assets
in the production environment. Without this change, the application would serve the precompiled assets from/assets
in development, and you would not see any local changes until you compile assets again.In practice, this will allow you to precompile locally, have those files in your working tree, and commit those files to source control when needed. Development mode will work as expected.
So, it looks like it might be a good idea to put precompiled assets into VCS on occasion.
精彩评论