2014-04-29 62 views
0

我不能用命令預編譯 - >bundle exec rake assets:precompile,它retuns我這個錯誤 - >Don't know how to build task 'assets:precompile'.我無法預編譯我的應用程序

之前預編譯,我做了bundle install --deployment --without development test

的Rails 3.0.11

紅寶石1.9.2p320(2012-04-20修訂35421)x86_64的Linux的]

+2

Rails 3.0.x中還沒有Asset Pipeline。這是在Rails 3.1中引入的。 –

回答

0

你說你用捆綁安裝預編譯,這不預編譯的資產,但安裝簡單的寶石,如果你想安裝更新d寶石到rails服務器只需再次運行bundle installbundle 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 
相關問題