config.rb中的SASS / compass路径导致编译时出现问题 [英] SASS/compass path in config.rb causing problem on compile

查看:131
本文介绍了config.rb中的SASS / compass路径导致编译时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我编译我的SCSS时,我得到一个文件未找到的错误,导致我相信我的config.rb有问题。命令行中的错误包括部分路径以及..相对目录:


文件未找到或不能阅读:
C:/ REALLY_LONG_PATH / C:/ REALLY_LONG_PATH /../ img / avatar.jpg

配置.rb的内容如下:

 #为我们的SASS / SCSS文件(此目录)划分目录
sass_path = File.dirname(__ FILE__)

#分隔CSS目录(在本示例中的资源/ css下)
css_path = File.join(sass_path,..,css)

#取消images目录
images_dir = File.join(sass_path,..,img)

#加载sencha-touch框架
load File.join(sass_path,'..','js','sencha','resources','themes')

#指定输出样式/环境
output_style =:展开
环境=:制作

如果我忽略CSS那在SCSS文件中引用它:

  background-image:inline-image('avatar.jpg'); 

但考虑到我想实际使用图片这一事实,这对我造成了一个问题。任何帮助将是肉汁。编辑:另一件值得注意的事实是,我的CSS似乎在适当的目录中呈现得很好,使用相同的格式作为img path。

解决方案

此时的解决方法是直接使用 url('image.jpg ')调用,但最终需要使用 inline-image('image.jpg')进行优化。 (这超出了这个线程的范围,所以我将此视为回答,除非有人有更好的解释。)



更新

更好的回答:相信错误,并确实包含它所需的文件。之前扔给我的是路径名称看起来不对,但可能是由于我自己的路径不适当的连接。另外,请不要在结果路径中间出现 .. 。它只是意味着向上移动目录,当然依然合法。

When I compile my SCSS, I'm getting a "file not found" error that leads me to believe there is something wrong with my config.rb. The error from the command line includes part of the path twice as well as the ".." relative directory:

File not found or cannot be read: C:/REALLY_LONG_PATH/C:/REALLY_LONG_PATH/../img/avatar.jpg

The config.rb reads as follows:

# 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

This error is not present if I omit the CSS that references it in the SCSS file:

background-image: inline-image('avatar.jpg');

But considering the fact that I'd like to actually use the image, this creates a problem for me. Any help would be gravy.

EDIT: Another thing worth noting is the fact that my CSS seems to render just fine in the appropriate directory using the identical format as the that of the img path.

解决方案

The workaround at this point is to use straight url('image.jpg') calls, but eventually inline-image('image.jpg') will need to be used for optimization. (Which is beyond the scope of this thread, so I'm counting this as answered, unless someone has a better explanation.)

UPDATE

Better answer: Trust the error and actually include the file(s) it says it needs. What threw me before was that the path name looked way wrong, but it was likely due to my own improper concatenation of the path. Also, don't be thrown by the ".." in the middle of the resulting path. It just means "move up a dir" and is, of course still legal.

这篇关于config.rb中的SASS / compass路径导致编译时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆