你說你用捆綁安裝預編譯,這不預編譯的資產,但安裝簡單的寶石,如果你想安裝更新d寶石到rails服務器只需再次運行bundle install
或bundle update
。沒有rails 3.0的資產管道。
如果你確實想使用管道資產有this backport,從文檔:
在你的Gemfile:
gem "sprockets_rails3_backport"
...plus whatever supplementary gems you want for the asset pipeline:
gem 'coffee-script', '2.2.0'
gem 'therubyracer', '0.9.9'
gem 'uglifier', '>= 1.0.3'
在你的routes.rb:
MyApp::Application.routes.draw do
if (app = Rails.application).config.assets.compile
mount app.assets => app.config.assets.prefix
end
# ...
end
這裏是各種config.assets選項及其默認值:
config.assets.paths = []
config.assets.precompile = [ Proc.new{ |path| !['.js', '.css'].include?(File.extname(path)) },
/(?:\/|\\|\A)application\.(css|js)$/ ]
config.assets.prefix = "/assets"
config.assets.version = ''
config.assets.debug = false
config.assets.compile = true
config.assets.digest = false
config.assets.manifest = nil
config.assets.cache_store = [ :file_store, "#{root}/tmp/cache/assets/" ]
config.assets.js_compressor = nil
config.assets.css_compressor = nil
config.assets.initialize_on_precompile = true
Rails 3.0.x中還沒有Asset Pipeline。這是在Rails 3.1中引入的。 –