From 06938a8b23ebfceae65de7c202cafe2505433032 Mon Sep 17 00:00:00 2001 From: Song myoungki Date: Fri, 9 Dec 2016 10:13:01 +0900 Subject: [PATCH] Fixed, issue #2 BrowserSync not reloading changes Fixed, reduced unnecessary processes in dev-building so that gulp build could be faster --- gulpfile.js | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 00435ce..4ca4acb 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,6 +2,8 @@ var elixir = require('laravel-elixir'); var webpack = require('webpack') require('laravel-elixir-webpack-ex'); +var isProduction = elixir.config.production; + /* |-------------------------------------------------------------------------- | Elixir Asset Management @@ -70,27 +72,35 @@ elixir(function(mix) { 'resources/assets/typescript' ); - mix.version([ - 'css/app.css', + var versioningFile = [ + 'css/app.css', 'js/app.js', - 'js/vendor.js', - 'js/all.js', - 'css/all.css' - ]); - - mix.scripts([ - 'vendor.js', - 'app.js' - ], 'public/js/all.js', 'public/js'); - - mix.styles([ - 'app.css' - ], 'public/css/all.css', 'public/css'); + 'js/vendor.js' + ]; + + // run only if gulp --production + if (isProduction) { + versioningFile = versioningFile.concat([ + 'js/all.js', + 'css/all.css' + ]); + + mix.scripts([ + 'vendor.js', + 'app.js' + ], 'public/js/all.js', 'public/js'); + + mix.styles([ + 'app.css' + ], 'public/css/all.css', 'public/css'); + } + + mix.version(versioningFile); mix.browserSync({ files: [ - "public/js/*", - "public/css/*" + "public/build/js/*", + "public/build/css/*" ], proxy: "localhost:8000" });