Add plotly and create a separate "graph" JS handler for gulp.

This commit is contained in:
Christopher Charbonneau Wells 2017-08-24 09:48:38 -04:00
parent 536283e3db
commit aafc44a70d
4 changed files with 24 additions and 2 deletions

View File

@ -25,6 +25,9 @@ module.exports = {
'node_modules/moment/moment.js', 'node_modules/moment/moment.js',
'node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js' 'node_modules/tempusdominus-bootstrap-4/build/js/tempusdominus-bootstrap-4.js'
], ],
graph: [
'node_modules/plotly.js/dist/plotly-cartesian.js'
],
app: [ app: [
'babyblotter/static_src/js/babyblotter.js', 'babyblotter/static_src/js/babyblotter.js',
'api/static_src/js/*.js', 'api/static_src/js/*.js',

View File

@ -13,7 +13,8 @@ gulp.task('compress', [
'compress:scripts:app', 'compress:scripts:app',
'compress:styles:app', 'compress:styles:app',
'compress:scripts:vendor', 'compress:scripts:vendor',
'compress:styles:vendor' 'compress:styles:vendor',
'compress:scripts:graph'
]); ]);
gulp.task('compress:scripts:app', ['scripts:app'], function (cb) { gulp.task('compress:scripts:app', ['scripts:app'], function (cb) {
@ -34,6 +35,15 @@ gulp.task('compress:scripts:vendor', ['scripts:vendor'], function (cb) {
], cb); ], cb);
}); });
gulp.task('compress:scripts:graph', ['scripts:graph'], function (cb) {
pump([
gulp.src(basePath + 'js/graph.js'),
concat('graph.min.js'),
uglify(),
gulp.dest(compressConfig.scripts.dest)
], cb);
});
gulp.task('compress:styles:app', ['styles:app'], function (cb) { gulp.task('compress:styles:app', ['styles:app'], function (cb) {
pump([ pump([
gulp.src(basePath + 'css/app.css'), gulp.src(basePath + 'css/app.css'),

View File

@ -6,7 +6,7 @@ var pump = require('pump');
var scriptsConfig = require('../config.js').scriptsConfig; var scriptsConfig = require('../config.js').scriptsConfig;
gulp.task('scripts', ['scripts:vendor', 'scripts:app']); gulp.task('scripts', ['scripts:vendor', 'scripts:graph', 'scripts:app']);
gulp.task('scripts:vendor', function(cb) { gulp.task('scripts:vendor', function(cb) {
pump([ pump([
@ -16,6 +16,14 @@ gulp.task('scripts:vendor', function(cb) {
], cb); ], cb);
}); });
gulp.task('scripts:graph', function(cb) {
pump([
gulp.src(scriptsConfig.graph),
concat('graph.js'),
gulp.dest(scriptsConfig.dest)
], cb);
});
gulp.task('scripts:app', function(cb) { gulp.task('scripts:app', function(cb) {
pump([ pump([
gulp.src(scriptsConfig.app), gulp.src(scriptsConfig.app),

View File

@ -15,6 +15,7 @@
"gulp-uglify": "^3.0.0", "gulp-uglify": "^3.0.0",
"jquery": "^3.2.1", "jquery": "^3.2.1",
"moment": "^2.18.1", "moment": "^2.18.1",
"plotly.js": "^1.30.0",
"popper.js": "^1.12.3", "popper.js": "^1.12.3",
"pump": "^1.0.2", "pump": "^1.0.2",
"require-dir": "^0.3.2", "require-dir": "^0.3.2",