Skip to content

Commit e42bbed

Browse files
committed
Added helper function to fix problem with windows paths in sass task
1 parent 089fb56 commit e42bbed

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

gulpfile.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,19 @@ var gulp = require('gulp'),
1212
// Prepare CSS
1313
// ===========
1414

15+
var processWinPath = function(file) {
16+
// Fix for bug with paths on Windows
17+
var path = require('path');
18+
if (process.platform === 'win32') {
19+
file.path = path.relative('.', file.path);
20+
file.path = file.path.replace(/\\/g, '/');
21+
}
22+
};
23+
1524
// Compile SASS and add prefixes
1625
var fnSass = function (path) {
1726
return gulp.src(path)
27+
.on('data', processWinPath)
1828
.pipe(plugins.plumber())
1929
.pipe(plugins.sass({
2030
sourceComments: 'map'
@@ -37,6 +47,7 @@ var fnSass = function (path) {
3747
gulp.task('styles:sass:imports', function () {
3848
var files = [config.app + '/+(sass|app|common)/**/*.scss', '!' + config.app + '/sass/includes/*.scss', '!' + config.app + '/+(app|common)/**/_*.scss'];
3949
return gulp.src(files, { read: false })
50+
.on('data', processWinPath)
4051
.pipe(plugins.intercept(function (file) {
4152
file.contents = new Buffer('@import \'' + file.path + '\';');
4253
return file;

0 commit comments

Comments
 (0)