mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 08:25:31 +00:00
Merge pull request #694 from nasa/fix-watch
[Build] reinstantiate compass per task execution
This commit is contained in:
commit
5d8efebc55
57
gulpfile.js
57
gulpfile.js
@ -71,30 +71,41 @@ var gulp = require('gulp'),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stream = require('stream'),
|
stream = require('stream');
|
||||||
compassWrapper = new stream.Transform({objectMode: true});
|
|
||||||
|
/**
|
||||||
|
* Returns a transform stream that allows us to customize the destination
|
||||||
|
* paths for individual sass files. Wraps compass.
|
||||||
|
*/
|
||||||
|
function customCompass() {
|
||||||
|
var compassWrapper = new stream.Transform({objectMode: true});
|
||||||
|
compassWrapper._transform = function (chunk, encoding, done) {
|
||||||
|
if (/\/_[^\/]*.scss$/.test(chunk.path)) {
|
||||||
|
return done();
|
||||||
|
}
|
||||||
|
var baseDir = 'platform/' + chunk.relative.replace(/sass\/.*$/, ''),
|
||||||
|
options = {
|
||||||
|
project: __dirname,
|
||||||
|
sass: baseDir + 'sass/',
|
||||||
|
css: baseDir + 'css/',
|
||||||
|
comments: true,
|
||||||
|
bundle_exec: true
|
||||||
|
},
|
||||||
|
compassObj;
|
||||||
|
|
||||||
|
compassObj = compass(options);
|
||||||
|
compassObj.on('data', function (file) {
|
||||||
|
this.push(file);
|
||||||
|
}.bind(this));
|
||||||
|
compassObj.on('end', function () {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
compassObj.end(chunk);
|
||||||
|
};
|
||||||
|
return compassWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
/* Transform stream that allows us to transform individual files */
|
|
||||||
compassWrapper._transform = function (chunk, encoding, done) {
|
|
||||||
if (/\/_[^\/]*.scss$/.test(chunk.path)) {
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
var baseDir = 'platform/' + chunk.relative.replace(/sass\/.*$/, ''),
|
|
||||||
options = {
|
|
||||||
project: __dirname,
|
|
||||||
sass: baseDir + 'sass/',
|
|
||||||
css: baseDir + 'css/',
|
|
||||||
comments: true,
|
|
||||||
bundle_exec: true
|
|
||||||
};
|
|
||||||
|
|
||||||
compass(options).on('data', function (file) {
|
|
||||||
done(null, file);
|
|
||||||
}).on('error', function (error) {
|
|
||||||
done(error);
|
|
||||||
})
|
|
||||||
.end(chunk);
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.task('scripts', function () {
|
gulp.task('scripts', function () {
|
||||||
return gulp.src(paths.main)
|
return gulp.src(paths.main)
|
||||||
@ -113,7 +124,7 @@ gulp.task('compass');
|
|||||||
|
|
||||||
gulp.task('stylesheets', function () {
|
gulp.task('stylesheets', function () {
|
||||||
return gulp.src(paths.scss)
|
return gulp.src(paths.scss)
|
||||||
.pipe(compassWrapper);
|
.pipe(customCompass());
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function () {
|
gulp.task('lint', function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user