Tôi đã có html5-rails và compass-html5 làm việc trong devlopment trên đường ray 3.1 nhưng khi tôi chạy ứng dụng của tôi trong chế độ sản xuất và cố gắng truy cập trang chủ của tôi, tôi nhận được như sau:AssetNotPrecompiledError khi sử dụng html5-ray đá quý trong env sản xuất
Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError in Home#index
polyfills.js isn't precompiled
Vấn đề là localhost: 8080: /assets/polyfills.js hiển thị. Tôi nghi ngờ có một vấn đề với các phương pháp của tôi:
bước để tái sản xuất:
Tạo ứng dụng đường ray mới với bộ điều khiển nhà, action index và thiết lập một lộ trình gốc và xóa công cộng/index. html và views/layouts/application.html.erb
Add sau để Gemfile
gem 'rails', '~> 3.1.0'
gem 'unicorn'
group :assets do
gem 'compass', "~> 0.12.alpha.0"
gem 'sass-rails', "~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'compass-html5', :git => 'https://github.com/sporkd/compass-html5.git'
gem 'html5-rails', :git => "https://github.com/sporkd/html5-rails.git"
end
Run rails g html5:install
để tạo /config/compass.rb tập tin
Tạo /config/initializers/sass.rb chứa đoạn mã sau:
Rails.configuration.sass.tap do |config|
config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
end
Chạy RAILS_ENV=production bundle exec rake assets:precompile
Run unicorn -E production
(hoặc rails s -e production
nếu bạn đang ở trên webrick) và truy cập thư mục gốc url
Quan sát lỗi
Các minified đúng đáp ứng-md5.min.js và modernizr- md5.min.js có mặt trong /công khai/tài sản. Mã js được biên dịch xuất hiện khi tôi truy cập localhost: 8080/assets/modernizr.min.js. Lỗi máy chủ được gửi khi tôi cố truy cập trang chủ của mình.
Tôi nghi ngờ có lỗi trong phương pháp của mình. Tôi đã hỏi cùng một câu hỏi here trên github.