[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:
Pete Richards
2016-02-19 11:18:54 -08:00
parent 6fee4f340f
commit ed09214f59
11 changed files with 43 additions and 17255 deletions

View File

@ -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' ]);