In my gulp task, I'd liked to do something like this.
.pipe(
$.if(!isProd, sass.sync({
outputStyle: 'expanded',
precision: 6,
includePaths: module.paths,
disableDeprecationWarnings: true
}))
.on('error', sass.logError))
module.paths is a predefined variable containing all the node_modules search paths to find installed packages. It returns already an array in the current form:
[
'/Volumes/Code/customer/project/styleguide/node_modules',
'/Volumes/Code/customer/project/node_modules',
'/Volumes/Code/customer/node_modules',
'/Volumes/Code/node_modules',
'/Volumes/node_modules',
'/node_modules'
]
This hasn't worked as expected, so I had to convert it to a string instead.
let incPath = module.paths.join(',');
Then I passed that into my sass compile task.
.pipe(
$.if(!isProd, sass.sync({
outputStyle: 'expanded',
precision: 6,
includePaths: incPath,
disableDeprecationWarnings: true
}))
.on('error', sass.logError))
I guess I found the issue here:
|
|
|
// Ensure file's parent directory in the include path |
|
if (opts.includePaths) { |
|
if (typeof opts.includePaths === 'string') { |
|
opts.includePaths = [opts.includePaths]; |
|
} |
|
} else { |
|
opts.includePaths = []; |
|
} |
|
|
|
opts.includePaths.unshift(path.dirname(file.path)); |
|
|
|
// Generate Source Maps if the source-map plugin is present |
It only checks for strings rather than for a path array. Is it safe to submit a PR for this change, or is there any reason more technical reason behind the check for the string story?
Happy to contribute this small adjustment.
In my gulp task, I'd liked to do something like this.
module.pathsis a predefined variable containing all the node_modules search paths to find installed packages. It returns already an array in the current form:This hasn't worked as expected, so I had to convert it to a string instead.
Then I passed that into my sass compile task.
I guess I found the issue here:
gulp-sass/index.js
Lines 122 to 134 in c04bb67
It only checks for strings rather than for a path array. Is it safe to submit a PR for this change, or is there any reason more technical reason behind the check for the string story?
Happy to contribute this small adjustment.