mirror of
https://github.com/nasa/openmct.git
synced 2025-01-18 10:46:42 +00:00
[Build] reinstantiate compass per task execution
Reinstantiate compass wrapper for each task execution. Allows stylesheets task to be run multiple times by watch. Fixes a bug that prevents watch from working properly.
This commit is contained in:
parent
6d036a5d67
commit
34b0b55b97
33
gulpfile.js
33
gulpfile.js
@ -71,10 +71,14 @@ var gulp = require('gulp'),
|
||||
}
|
||||
}
|
||||
},
|
||||
stream = require('stream'),
|
||||
compassWrapper = new stream.Transform({objectMode: true});
|
||||
stream = require('stream');
|
||||
|
||||
/* Transform stream that allows us to transform individual files */
|
||||
/**
|
||||
* 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();
|
||||
@ -86,15 +90,22 @@ compassWrapper._transform = function (chunk, encoding, done) {
|
||||
css: baseDir + 'css/',
|
||||
comments: true,
|
||||
bundle_exec: true
|
||||
};
|
||||
},
|
||||
compassObj;
|
||||
|
||||
compass(options).on('data', function (file) {
|
||||
done(null, file);
|
||||
}).on('error', function (error) {
|
||||
done(error);
|
||||
})
|
||||
.end(chunk);
|
||||
compassObj = compass(options);
|
||||
compassObj.on('data', function (file) {
|
||||
this.push(file);
|
||||
}.bind(this));
|
||||
compassObj.on('end', function () {
|
||||
done();
|
||||
});
|
||||
compassObj.end(chunk);
|
||||
};
|
||||
return compassWrapper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
gulp.task('scripts', function () {
|
||||
return gulp.src(paths.main)
|
||||
@ -113,7 +124,7 @@ gulp.task('compass');
|
||||
|
||||
gulp.task('stylesheets', function () {
|
||||
return gulp.src(paths.scss)
|
||||
.pipe(compassWrapper);
|
||||
.pipe(customCompass());
|
||||
});
|
||||
|
||||
gulp.task('lint', function () {
|
||||
|
Loading…
Reference in New Issue
Block a user