我已经尝试了很多回复,但由于某种原因,我无法让它发挥作用。错误是:
No files were found in the load path matching "sprites/*.png"
我的config.rb代码:
relative_assets = true
cache=false
Encoding.default_external = "utf-8"
#########
# 1. Set this to the root of your project when deployed:
http_path = "/"
http_generated_images_path = "../images";
# 2. probably don't need to touch these
css_dir = "../css"
sass_dir = "./"
images_dir = "../images"
images_path = "../images"
javascripts_dir = "../js"
environment = :development
line_comments = true
我的文件夹结构:
css
images
- sprites
scss (config.rb located in scss folder)
- partials
- - _mixins.scss (the file where the error is occuring)
在mixins中:
@import "sprites/*.png";
任何想法路径的错误是什么?
感谢您的帮助。
答案 0 :(得分:1)
第一个问题是:你的sprites文件夹中是否有任何文件?如果是,请尝试添加此设置:
generated_images_path = "../images"
http_generated_images_path将用于定义生成的图像的最终路径,在最终(已编译)的CSS中,因此上面的设置(没有http_)可能是您需要的。我的项目结构不同但它对我来说很好,我有更多的设置指向同一条路径,这就是我所拥有的:
images_dir = "/assets/img"
generated_images_path = "assets/img"
http_images_dir = "assets/img"
http_images_path = "assets/img"
如果只是第一个没有为您解决问题,请尝试添加所有这些? 最糟糕的情况是改变你的项目结构,所以你不必上升到一个级别来获取文件夹(不是说这是问题,因为它应该不是很好,测试是找出的最好方法)
答案 1 :(得分:0)
我在这里尝试了各种选择。最后我更新到Ruby 2.1.5并关闭了Sublime的Compass“save on build”插件,它似乎修复了它。不是一个完美的解决方案,但它现在有效!