SASS/compass path in config.rb causing problem on compile

有些话、适合烂在心里 提交于 2019-12-08 12:39:34

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/6393161/sass-compass-path-in-config-rb-causing-problem-on-compile

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