From ba9a6d7abf7c0e110c396e310ece7ae37bf0826d Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Sat, 14 Apr 2018 12:07:49 -0500 Subject: [PATCH 1/2] adds live-reload with LiveReloadPlugin --- generators/assets/webpack/templates/package.json.tmpl | 1 + generators/assets/webpack/templates/webpack.config.js.tmpl | 5 ++++- generators/newapp/templates/templates/application.html.tmpl | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/generators/assets/webpack/templates/package.json.tmpl b/generators/assets/webpack/templates/package.json.tmpl index 99ca12cda..28e679c1e 100644 --- a/generators/assets/webpack/templates/package.json.tmpl +++ b/generators/assets/webpack/templates/package.json.tmpl @@ -34,6 +34,7 @@ "url-loader": "~1.0.1", "webpack": "~4.5.0", "webpack-cli": "2.0.14", + "webpack-livereload-plugin":"2.1.1", "webpack-manifest-plugin": "~2.0.0" } } diff --git a/generators/assets/webpack/templates/webpack.config.js.tmpl b/generators/assets/webpack/templates/webpack.config.js.tmpl index 3ff8a9967..c463d2f4a 100644 --- a/generators/assets/webpack/templates/webpack.config.js.tmpl +++ b/generators/assets/webpack/templates/webpack.config.js.tmpl @@ -1,10 +1,12 @@ const Webpack = require("webpack"); const Glob = require("glob"); +const path = require("path"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const ManifestPlugin = require("webpack-manifest-plugin"); const CleanObsoleteChunks = require('webpack-clean-obsolete-chunks'); const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); +const LiveReloadPlugin = require('webpack-livereload-plugin'); const configurator = { entries: function(){ @@ -80,7 +82,8 @@ const configurator = { module: configurator.moduleOptions() } - if( env == "development" ){ + if( env === "development" ){ + config.plugins.push(new LiveReloadPlugin()) return config } diff --git a/generators/newapp/templates/templates/application.html.tmpl b/generators/newapp/templates/templates/application.html.tmpl index 90bef899e..3faaa8d63 100644 --- a/generators/newapp/templates/templates/application.html.tmpl +++ b/generators/newapp/templates/templates/application.html.tmpl @@ -24,5 +24,10 @@ <%= javascriptTag("application.js") %> + + <%= if( env == "development") { %> + + + <% } %> From 25539adb93a1382caf3d2297deedffc3e3861587 Mon Sep 17 00:00:00 2001 From: Antonio Pagano Date: Sat, 14 Apr 2018 15:39:51 -0500 Subject: [PATCH 2/2] aset livereloadplugin to inject reload tag --- generators/assets/webpack/templates/webpack.config.js.tmpl | 2 +- generators/newapp/templates/templates/application.html.tmpl | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/generators/assets/webpack/templates/webpack.config.js.tmpl b/generators/assets/webpack/templates/webpack.config.js.tmpl index c463d2f4a..2f613e260 100644 --- a/generators/assets/webpack/templates/webpack.config.js.tmpl +++ b/generators/assets/webpack/templates/webpack.config.js.tmpl @@ -83,7 +83,7 @@ const configurator = { } if( env === "development" ){ - config.plugins.push(new LiveReloadPlugin()) + config.plugins.push(new LiveReloadPlugin({appendScriptTag: true})) return config } diff --git a/generators/newapp/templates/templates/application.html.tmpl b/generators/newapp/templates/templates/application.html.tmpl index 3faaa8d63..90bef899e 100644 --- a/generators/newapp/templates/templates/application.html.tmpl +++ b/generators/newapp/templates/templates/application.html.tmpl @@ -24,10 +24,5 @@ <%= javascriptTag("application.js") %> - - <%= if( env == "development") { %> - - - <% } %>