我正在浏览bower foundation project,但我被这个项目如何能够定位部分参数给难住了。特别是,我正在看_settings.scss that has a relative reference in it,我就是不太明白。
在58行有一个对foundation/functions的引用,但是这个partial (_functions.scss)是设置partial的同级。我搞不懂为什么该行上会有对父目录foundation的引用。我也不明白这是如何工作的。为什么设置文件不会在同一级别查找名为foundation的目录?
发布于 2014-12-04 07:27:33
如果您尝试导入不存在的文件,答案将变得清晰。以下是您尝试import "foo"; (不存在)时在http://sassmeister.com/上生成的错误的摘录:
File to import not found or unreadable: foo.
Load paths:
/app
/app/lib/sass_modules
/app/vendor/bundle/ruby/2.0.0/gems/compass-0.12.6/frameworks/blueprint/stylesheets
/app/vendor/bundle/ruby/2.0.0/gems/compass-0.12.6/frameworks/compass/stylesheets
/app/vendor/bundle/ruby/2.0.0/gems/susy-1.0.9/sass如果Sass开始搜索与这些目录中的每个目录相关的请求文件,直到找到它。
对于vanilla Sass,可以通过--import-path选项添加额外的路径:
sass --watch test.scss:test.css --load-path ../path/to/lib/ --load-path ../path/to/otherlib/Compass用户将在其config.rb中使用additional_import_paths或add_import_path (请参阅:http://compass-style.org/help/documentation/configuration-reference/)
add_import_path "../path/to/lib/"只有Foundation的作者才能回答您的特定问题,即他们为什么要以这种方式编写导入。但这就是它起作用的原因。
发布于 2014-12-09 23:58:35
查看config.rb的第2行
add_import_path "bower_components/foundation/scss"如果您查看文件中的sass,那么bower_component/foundation/_oundation.scss中包含了foundation/components中其余组件的全面导入
https://stackoverflow.com/questions/27282608
复制相似问题