mirror of
https://github.com/nasa/openmct.git
synced 2025-06-21 00:23:01 +00:00
[Build] Save stylesheets to proper location
Updates the stylesheet task to output CSS in the correct locations. Remove config.rb for running compass manually, and remove compiled css files from project. Add a .gitignore to ensure they don't get included accidentally. Add a gulp task for running the development server and watching for scss changes at the same time. resolves https://github.com/nasa/openmctweb/issues/238
This commit is contained in:
46
gulpfile.js
46
gulpfile.js
@ -59,7 +59,8 @@ var gulp = require('gulp'),
|
||||
},
|
||||
compass: {
|
||||
sass: __dirname,
|
||||
css: paths.assets
|
||||
css: paths.assets,
|
||||
sourcemap: true
|
||||
},
|
||||
replace: {
|
||||
variables: {
|
||||
@ -69,7 +70,30 @@ var gulp = require('gulp'),
|
||||
branch: fs.existsSync('.git') ? git.branch() : 'Unknown'
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
stream = require('stream'),
|
||||
compassWrapper = new stream.Transform({objectMode: true});
|
||||
|
||||
/* 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
|
||||
};
|
||||
|
||||
compass(options).on('data', function (file) {
|
||||
done(null, file);
|
||||
}).on('error', function (error) {
|
||||
done(error);
|
||||
})
|
||||
.end(chunk);
|
||||
};
|
||||
|
||||
gulp.task('scripts', function () {
|
||||
return gulp.src(paths.main)
|
||||
@ -84,10 +108,11 @@ gulp.task('test', function (done) {
|
||||
new karma.Server(options.karma, done).start();
|
||||
});
|
||||
|
||||
gulp.task('compass');
|
||||
|
||||
gulp.task('stylesheets', function () {
|
||||
return gulp.src(paths.scss)
|
||||
.pipe(compass(options.compass))
|
||||
.pipe(gulp.dest(paths.assets));
|
||||
.pipe(compassWrapper);
|
||||
});
|
||||
|
||||
gulp.task('lint', function () {
|
||||
@ -110,11 +135,22 @@ gulp.task('fixstyle', function () {
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
gulp.task('static', function () {
|
||||
gulp.task('static', ['stylesheets'], function () {
|
||||
return gulp.src(paths.static, { base: '.' })
|
||||
.pipe(gulp.dest(paths.dist));
|
||||
});
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(paths.scss, ['stylesheets']);
|
||||
});
|
||||
|
||||
gulp.task('serve', function () {
|
||||
console.log('Running development server with all defaults');
|
||||
var app = require('./app.js');
|
||||
});
|
||||
|
||||
gulp.task('develop', ['serve', 'watch']);
|
||||
|
||||
gulp.task('install', [ 'static', 'scripts' ]);
|
||||
|
||||
gulp.task('verify', [ 'lint', 'test' ]);
|
||||
|
Reference in New Issue
Block a user