Sprockets generating incorrect logical_path for javascript files

放肆的年华 提交于 2020-01-05 12:16:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!