问题
Sprockets seems to make an error in determining the logical_path of my javascript assets (except for application.js). It prepends "../javascripts" to the path and so my references are wrong and the application.js file won't precompile. I'm using Rails Thin server on Windows.
Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.3'
gem 'eventmachine', '1.0.0.beta.4.1'
gem 'thin'
gem 'mysql'
gem 'win32-open3-19'
gem 'paperclip', '2.3.8'
gem 'jsmin'
gem 'will_paginate'
gem 'jquery-rails'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
I've created a new app and on it's own, there are no problems. It's only when I copy the files from my current app over that the problem starts. I've tried disabling all extraneous gems but the problem persists (leading me to believe it's not a gem that's causing the problem).
回答1:
Wow. Apparently Sprockets pukes invisible chunks when it finds a folder called "java" under "assets" and simply doesn't process anything else from that point forward for js files. Under /assets I had "images", "javascripts", "java" (for java applets) and "stylesheets". Changing "java" to "applets"
"FIXED"
the problem.
来源:https://stackoverflow.com/questions/8510813/sprockets-generating-incorrect-logical-path-for-javascript-files