How to connect Susy correctly if I use gulp and sass is already installed.

I am trying to connect as follows:

@import "node_modules/susy/sass/_susy.scss"; 

But if so connected, then clearfix does not work ; for example, does not find it. And if you use @include span(6); then the span(6) ; works. So how is Susy properly connected?

  • I'm not exactly sure yet, but it was necessary to use susy-clearfix; - Niko_D
  • I will leave it here for the time being, and as I get to the computer, I will explain if you do not guess. - D-side
  • @ D-side - I haven't figured it out yet, but I’ll still see, only a little later. - Niko_D

1 answer 1

It is necessary to tell Sass the "include paths" , the places where the files of additional libraries are expected, so that the import is as dull as possible, does not count on anything and is easily transferred to any tolerable build system (at least to the same Compass). Import of this type:

 @import "susy"; 

This imports the _susy.scss or _susy.sass from the current folder or "include paths" .

And here begin quite funny problems. Different libraries publish their file paths in different ways. But in the end, in gulpfile.js should get a structure of this type:

 sass({ includePaths: [путь] // здесь должны быть перечислены пути к используемым библиотекам }) 

It remains to find a путь . There are good people who export paths at the entry point * , but the authors of Susy indicated the SCSS file as the entry point. Quite a mysterious move, but you can get the path to it and cut off the file name, leaving only the folder:

 path = require('path') susy_main = require.resolve('susy') // получение абсолютного пути к точке входа susy susy_dir = path.dirname(susy_main) // путь, полный, с точкой входа, но нужна только папка 

Everything, the necessary way (absolute!) Lies in susy_dir .


* Modules in NodeJS are usually packaged in folders of the same name, and when require(название) is done, an object is returned that exports its entry point : the file specified in package.json under the key "main" (and if there is no such key, it will guess see instructions ). Following the example of the link above, here is an indication of the entry point to Bourbon .

blocked by PashaPash 9 Jun '16 at 10:22

This post has been blocked due to a large number of off-topic comments. For detailed discussions, use chat .

  • Comments are not intended for extended discussion; conversation moved to chat . - Nick Volynkin