SASS的@import
是最常用的功能之一,默认我们可以使用相对,绝对路径来以当前目录为根节点进行文件的查找,但是有时候我们需要引入的文件并不在我们的当前目录下(并且文件位置相差很大,特别是很多需要被多个项目共用的框架等,如compass)。
针对这样的需求,SASS 可以通过指定--load-path
来添加一个额外用于查找的路径,可以看官方文档:http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import
Sass looks for other Sass files in the current directory, and the Sass file directory under Rack, Rails, or Merb. Additional search directories may be specified using the :load_paths option, or the --load-path option on the command line.
下面举个例子,来说明如何使用: