From f9ea55d57b15c5f767592684d2b01d776f9a5e88 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 20 Sep 2016 12:52:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20=20Gulp=20tooling=20for=20ghost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refs #7427 Use `gulp dev` to start development mode. Starts ember build and does livereload for client and server changes. Use `gulp server` to start server development mode. Doesn't start ember build and livereloads for server changes only. --- gulpfile.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 ++++ 2 files changed, 55 insertions(+) create mode 100644 gulpfile.js diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000000..3743b24b07 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,51 @@ +var gulp = require('gulp'), + livereload = require('gulp-livereload'), + nodemon = require('gulp-nodemon'), + shell = require('gulp-shell'), + chalk = require('chalk'), + paths, + nodemonServerInit; + +paths = { + server: 'core/server/', + client: 'core/client/' +}; + +nodemonServerInit = function () { + livereload.listen(); + + return nodemon({ + script: 'index.js', + ext: 'js,json,hbs', + watch: [ + 'core/index.js', + paths.server + '**/*.js', + paths.server + '**/*.json', + paths.server + '**/*.hbs', + 'core/built/assets/*.js' + ], + ignore: [ + 'core/client/*', + 'core/server/test/*' + ] + }).on('restart', function () { + console.info(chalk.cyan('Restarting Ghost due to changes...')); + gulp.src('index.js') + .pipe(livereload()); + }); +}; + +// Starting the 🚗 to run the server only +// No client watch here. +gulp.task('server', function () { + nodemonServerInit(); +}); + +// Run `gulp dev` to enter development mode +// Filechanges in client will force a livereload +gulp.task('dev', ['server'], shell.task(['ember build --watch'], { + cwd: paths.client, + env: { + FORCE_COLOR: true // this is a fun little tidbit that will pass the colors from Ember to the main process + } +})); diff --git a/package.json b/package.json index 4608147aff..837e330623 100644 --- a/package.json +++ b/package.json @@ -106,6 +106,10 @@ "grunt-shell": "1.3.1", "grunt-subgrunt": "1.2.0", "grunt-update-submodules": "0.4.1", + "gulp": "3.9.1", + "gulp-livereload": "3.8.1", + "gulp-nodemon": "2.1.0", + "gulp-shell": "0.5.2", "istanbul": "0.4.5", "matchdep": "1.0.1", "mocha": "3.0.2",