链轮为javascript文件生成了不正确的logical_path [英] Sprockets generating incorrect logical_path for javascript files
问题描述
链轮似乎在确定我的JavaScript资产的逻辑路径时出错(application.js除外).它在路径前加上"../javascripts",因此我的引用有误,并且application.js文件不会进行预编译.我在Windows上使用Rails Thin服务器.
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.
宝石文件:
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).
推荐答案
哇.显然,Sprockets在"assets"下找到一个名为"java"的文件夹时会呕吐不可见的块,并且从此以后根本不处理js文件.在/assets下,我有"images","javascripts","java"(对于Java applet)和"stylesheets".将"java"更改为"applets"
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"
已修复"
问题.
这篇关于链轮为javascript文件生成了不正确的logical_path的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!