From 1b7cb8ccb0e3cc1b2f099101061536ff2888907b Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 18 Feb 2016 14:51:55 -0600 Subject: [PATCH] chore(demos): don't bundle demos when developing Rebundling all demos on every change takes 1 minute, only do it for production. --- demos/output.ios.scss | 5 ++-- demos/output.md.scss | 5 ++-- gulpfile.js | 30 +++++++++++++++----- scripts/demos/index.template.dev.html | 40 +++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 13 deletions(-) create mode 100644 scripts/demos/index.template.dev.html diff --git a/demos/output.ios.scss b/demos/output.ios.scss index 1dd0c0ebb3..052237e8f5 100644 --- a/demos/output.ios.scss +++ b/demos/output.ios.scss @@ -1,5 +1,4 @@ -$font-path: "/fonts"; -$roboto-font-path: "/fonts"; - +$font-path: "../fonts"; +$roboto-font-path: "../fonts"; @import "../ionic/ionic.ios"; diff --git a/demos/output.md.scss b/demos/output.md.scss index d9a0a3c124..d4d8a86aa8 100644 --- a/demos/output.md.scss +++ b/demos/output.md.scss @@ -1,5 +1,4 @@ -$font-path: "/fonts"; -$roboto-font-path: "/fonts"; - +$font-path: "../fonts"; +$roboto-font-path: "../fonts"; @import "../ionic/ionic.md"; diff --git a/gulpfile.js b/gulpfile.js index 34b9b67cf9..bdab797f46 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -485,10 +485,22 @@ gulp.task('tests', function() { * Builds Ionic demos to dist/demos, copies them to ../ionic-site and watches * for changes. */ -gulp.task('watch.demos', ['demos'], function() { - watch('demos/**/*', function() { - gulp.start('demos'); - }); +//TODO, decide on workflow for site demos (dev and prod), vs local dev (in dist) +var LOCAL_DEMOS = false; +gulp.task('watch.demos', function(done) { + LOCAL_DEMOS = true; + runSequence( + ['build.demos', 'transpile', 'copy.libs', 'sass', 'fonts'], + function(){ + watchTask('bundle.system'); + + watch('demos/**/*', function(file) { + gulp.start('build.demos'); + }); + + done(); + } + ); }); /** @@ -510,6 +522,10 @@ gulp.task('demos', ['bundle.demos'], function() { return merge([demosStream, cssStream]); }); + gulp.task('demos.dev', function() { + + }); + /** * Builds necessary files for each demo then bundles them using webpack. Unlike * e2e tests, demos are bundled for performance (but have a slower build). @@ -560,10 +576,10 @@ gulp.task('build.demos', function() { var fs = require('fs'); var VinylFile = require('vinyl'); - var baseIndexTemplate = _.template(fs.readFileSync('scripts/demos/index.template.html'))(); - var flags = minimist(process.argv.slice(2), flagConfig); + var indexTemplateName = LOCAL_DEMOS ? 'index.template.dev.html' : 'index.template.html'; + var baseIndexTemplate = _.template(fs.readFileSync('scripts/demos/' + indexTemplateName))(); - if ("production" in flags) { + if (flags.production) { buildDemoSass(true); } else { buildDemoSass(false); diff --git a/scripts/demos/index.template.dev.html b/scripts/demos/index.template.dev.html new file mode 100644 index 0000000000..2085214ab7 --- /dev/null +++ b/scripts/demos/index.template.dev.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +