add targets to the gulpfile to simplify testing how various local specs display
(and modifying and looking again at those specs iteratively) new gulp targets: dev-dist: [lint, copy] (this runs the same code in dist, but without doing a clean first) dev: [default, serve] (the task to run if you're iteratively making changes and don't want/need the dist directory to be regenerated every time)
This commit is contained in:
17
gulpfile.js
17
gulpfile.js
@@ -61,8 +61,10 @@ gulp.task('lint', function () {
|
|||||||
/**
|
/**
|
||||||
* Build a distribution
|
* Build a distribution
|
||||||
*/
|
*/
|
||||||
gulp.task('dist', ['clean','lint'], function() {
|
gulp.task('dist', ['clean', 'lint'], _dist);
|
||||||
|
gulp.task('dev-dist', ['lint', 'copy'], _dist);
|
||||||
|
|
||||||
|
function _dist() {
|
||||||
return es.merge(
|
return es.merge(
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'./src/main/javascript/**/*.js',
|
'./src/main/javascript/**/*.js',
|
||||||
@@ -81,7 +83,7 @@ gulp.task('dist', ['clean','lint'], function() {
|
|||||||
.on('error', log)
|
.on('error', log)
|
||||||
.pipe(gulp.dest('./dist'))
|
.pipe(gulp.dest('./dist'))
|
||||||
.pipe(connect.reload());
|
.pipe(connect.reload());
|
||||||
});
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processes less files into CSS files
|
* Processes less files into CSS files
|
||||||
@@ -124,14 +126,20 @@ gulp.task('copy', ['less'], function() {
|
|||||||
.src(['./src/main/html/**/*'])
|
.src(['./src/main/html/**/*'])
|
||||||
.pipe(gulp.dest('./dist'))
|
.pipe(gulp.dest('./dist'))
|
||||||
.on('error', log);
|
.on('error', log);
|
||||||
|
|
||||||
|
// copy the test specs
|
||||||
|
gulp
|
||||||
|
.src(['./test/specs/**/*'])
|
||||||
|
.pipe(gulp.dest('./dist/specs'))
|
||||||
|
.on('error', log);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Watch for changes and recompile
|
* Watch for changes and recompile
|
||||||
*/
|
*/
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function() {
|
||||||
return watch(['./src/**/*.{js,less,handlebars}'], function() {
|
return watch(['./src/**/*.{js,less,handlebars}', './test/specs/**/*.{json,yaml}'], function() {
|
||||||
gulp.start('default');
|
gulp.start('dev-dist');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -152,3 +160,4 @@ function log(error) {
|
|||||||
|
|
||||||
gulp.task('default', ['dist', 'copy']);
|
gulp.task('default', ['dist', 'copy']);
|
||||||
gulp.task('serve', ['connect', 'watch']);
|
gulp.task('serve', ['connect', 'watch']);
|
||||||
|
gulp.task('dev', ['default', 'serve']);
|
||||||
|
|||||||
Reference in New Issue
Block a user