【发布时间】:2011-09-17 14:25:29
【问题描述】:
当我编译我的 SCSS 时,我收到一个“找不到文件”错误,这让我相信我的 config.rb 有问题。来自命令行的错误包括路径的一部分以及“..”相对目录的两倍:
文件未找到或无法读取: C:/REALLY_LONG_PATH/C:/REALLY_LONG_PATH/../img/avatar.jpg
config.rb 内容如下:
# Delineate the directory for our SASS/SCSS files (this directory)
sass_path = File.dirname(__FILE__)
# Delineate the CSS directory (under resources/css in this demo)
css_path = File.join(sass_path, "..", "css")
# Delinate the images directory
images_dir = File.join(sass_path, "..", "img")
# Load the sencha-touch framework
load File.join(sass_path, '..', 'js', 'sencha', 'resources', 'themes')
# Specify the output style/environment
output_style = :expanded
environment = :production
如果我在 SCSS 文件中省略了引用它的 CSS,则不会出现此错误:
background-image: inline-image('avatar.jpg');
但考虑到我想实际使用该图像这一事实,这给我带来了问题。任何帮助都会很重要。
编辑:另一件值得注意的事情是,我的 CSS 似乎使用与 img 路径相同的格式在适当的目录中渲染得很好。
【问题讨论】:
-
为什么你的路径名很长?
-
只是为了说明而缩短。那不是一些路径变量或其他东西。感谢您的检查。
-
我想知道这是否是 Windows/Ruby 的问题...如果您了解路径的工作原理,您可以尝试使用绝对路径而不是相对路径吗?
-
是的,这没有什么坏处,考虑到只有编译后的 CSS 才能上线。当我重新开始优化并需要做内联图像时,我可能会尝试这样做。
标签: ruby rubygems sencha-touch sass compass-sass