How does SCSS detect partial parts?

I am looking at a bower foundation project and I am embarrassed about how a project can find partial ones. In particular, I look at _settings.scss which has a relative link. I just do not quite understand.

Line 58 has a link to foundation/functions, but this partial ( _functions.scss) is a paired settings item. I am confused why there is a link to the parent directory on this line foundation. I am also confused about how this works. Why isn't the settings file looking for a directory named foundation at the same level?

+2
source share
2 answers

The answer becomes clear if you are trying to import a file that does not exist. This subtracts the error generated at http://sassmeister.com/ when trying import "foo";(which does not exist):

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

If Sass starts searching for the requested file for each of these directories, until it finds it.

For vanilla sass, you can add additional paths through the option --import-path:

sass --watch test.scss:test.css --load-path ../path/to/lib/ --load-path ../path/to/otherlib/

Compass users would use additional_import_pathseither add_import_pathin their config.rb (see http://compass-style.org/help/documentation/configuration-reference/ )

add_import_path "../path/to/lib/"

Only authors of the Fund can answer your specific question about why they will write the import in this way. But that’s why it works.

+1
source

Look at line 2 of your config.rb

add_import_path "bower_components/foundation/scss"

sass , bower_components/foundation/_foundation.scss /

0

All Articles