diff --git a/app.js b/app.js index 15e298b7..6c9f59dc 100755 --- a/app.js +++ b/app.js @@ -211,4 +211,16 @@ app.use((err, req, res) => { // Run the application app.listen(port); +if ( + process.env.WATCH !== 'true' // If the user isn’t running watch + && process.env.NODE_ENV !== 'production' // and it’s not in production mode +) { + /* eslint-disable no-console */ + console.info(`Running at http://localhost:${port}/`); + console.info(''); + console.warn('Warning: It looks like you may have run the command `npm start` locally.'); + console.warn('Press `Ctrl+C` and then run `npm run watch` instead'); + /* eslint-enable no-console */ +} + module.exports = app; diff --git a/gulpfile.js b/gulpfile.js index 1941de66..c9362017 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -109,13 +109,19 @@ function watch() { gulp.watch('app/assets/**/**/*.*', compileAssets); } +function setWatchEnv(done) { + process.env.WATCH = 'true'; + done(); +} + exports.watch = watch; exports.compileStyles = compileStyles; exports.compileScripts = compileScripts; exports.cleanPublic = cleanPublic; +exports.setWatchEnv = setWatchEnv; gulp.task( 'build', gulp.series(cleanPublic, compileStyles, compileScripts, compileAssets) ); -gulp.task('default', gulp.series(startNodemon, startBrowserSync, watch)); +gulp.task('default', gulp.series(setWatchEnv, startNodemon, startBrowserSync, watch));