grunt-contrib-sass icon indicating copy to clipboard operation
grunt-contrib-sass copied to clipboard

loadPath doesn't find node_modules package

Open chenasraf opened this issue 8 years ago • 1 comments

I'm not sure what I'm doing wrong - I have a .scss file like this:

//// Start Bootstrap
// Core variables and mixins
@import "bootstrap/variables";
@import "bootstrap/mixins";

// Reset and dependencies
@import "bootstrap/normalize";
@import "bootstrap/print";
@import "bootstrap/glyphicons";

// Core CSS
@import "bootstrap/scaffolding";
@import "bootstrap/type";
@import "bootstrap/code";
@import "bootstrap/grid";

// Utility classes
@import "bootstrap/utilities";
@import "bootstrap/responsive-utilities";
@import "bootstrap/tooltip";
//// End Bootstrap

And then my Gruntfile looks like this:

sass: {
      dist: {
        options: {
          style: 'expanded',
          loadPaths: ['node_modules/bootstrap-sass/assets/stylesheets/'],
          require: 'bootstrap-sass' // tried with/without
        },
        files: {
          'dist/css/app.css': 'src/sass/app/app.scss',
        }
      }
    }

But when attempting to compile I get the following error:

>> Error: File to import not found or unreadable: bootstrap/variables.
>>        Parent style sheet: <path>/src/sass/<file>.scss
>>         on line 3 of src/sass/<file>.scss
>> >> @import "bootstrap/variables";
>>    ^
Warning:  Use --force to continue.

Aborted due to warnings.

What am I doing wrong? I checked the path and it is indeed valid, so I'm not sure why this would happen. I also tried adding file extensions and underscores to the import but it didn't work.

chenasraf avatar Aug 20 '17 15:08 chenasraf

The correct option name seems to be "includePaths", not "loadPath".

andrejpavlovic avatar Nov 16 '17 14:11 andrejpavlovic