Add data
gulp task.
This adds a new Gulp task to automatically include `app/data` in dev builds if it exists. This directory will contain sample data files for use during development and outputs them to `build/data`. Additionally, this integrates with browser-sync and will automatically reload open browsers as testing datasets are changed. Change-Id: Ie1578682d11e36bd6142b9d326f50a547aa4613b
This commit is contained in:
parent
6ae7d8ace1
commit
df8c054819
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@ stackviz/static/components/*
|
|||||||
node_modules
|
node_modules
|
||||||
build
|
build
|
||||||
app/js/templates.js
|
app/js/templates.js
|
||||||
|
app/data
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
|
@ -55,6 +55,11 @@ module.exports = {
|
|||||||
'test': {
|
'test': {
|
||||||
'karma': 'test/karma.conf.js',
|
'karma': 'test/karma.conf.js',
|
||||||
'protractor': 'test/protractor.conf.js'
|
'protractor': 'test/protractor.conf.js'
|
||||||
|
},
|
||||||
|
|
||||||
|
'data': {
|
||||||
|
'src' : ['app/data/**/*'],
|
||||||
|
'dest': 'build/data'
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
15
gulp/tasks/data.js
Normal file
15
gulp/tasks/data.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
var config = require('../config');
|
||||||
|
var changed = require('gulp-changed');
|
||||||
|
var gulp = require('gulp');
|
||||||
|
var browserSync = require('browser-sync');
|
||||||
|
|
||||||
|
gulp.task('data', function() {
|
||||||
|
|
||||||
|
return gulp.src(config.data.src)
|
||||||
|
.pipe(changed(config.data.dest))
|
||||||
|
.pipe(gulp.dest(config.data.dest))
|
||||||
|
.pipe(browserSync.reload({ stream: true, once: true }));
|
||||||
|
|
||||||
|
});
|
@ -9,6 +9,6 @@ gulp.task('dev', ['clean'], function(cb) {
|
|||||||
|
|
||||||
global.isProd = false;
|
global.isProd = false;
|
||||||
|
|
||||||
runSequence(['styles', 'images', 'fonts', 'views', 'browserify'], 'watch', cb);
|
runSequence(['styles', 'images', 'fonts', 'data', 'views', 'browserify'], 'watch', cb);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -10,6 +10,7 @@ gulp.task('watch', ['browserSync', 'server'], function() {
|
|||||||
gulp.watch(config.styles.src, ['styles']);
|
gulp.watch(config.styles.src, ['styles']);
|
||||||
gulp.watch(config.images.src, ['images']);
|
gulp.watch(config.images.src, ['images']);
|
||||||
gulp.watch(config.fonts.src, ['fonts']);
|
gulp.watch(config.fonts.src, ['fonts']);
|
||||||
|
gulp.watch(config.data.src, ['data']);
|
||||||
gulp.watch(config.views.watch, ['views']);
|
gulp.watch(config.views.watch, ['views']);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user