diff --git a/index.html b/index_template.html similarity index 73% rename from index.html rename to index_template.html index fd3c59e9..a85d0d87 100644 --- a/index.html +++ b/index_template.html @@ -1,4 +1,4 @@ - + @@ -10,16 +10,7 @@ ascribe - - <% DEBUG && print('') %> - - - - diff --git a/package.json b/package.json index 9f66cfcc..650a665d 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "extract-text-webpack-plugin": "^1.0.1", "file-loader": "^0.8.5", "history": "1.17.0", + "html-webpack-plugin": "^2.19.0", "invariant": "^2.1.1", "isomorphic-fetch": "^2.0.2", "moment": "^2.10.6", diff --git a/webpack.config.js b/webpack.config.js index e202db69..5522ef8b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,7 @@ const webpack = require('webpack'); const autoPrefixer = require('autoprefixer'); const combineLoaders = require('webpack-combine-loaders'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); require('dotenv').load({ silent: true }); @@ -38,6 +39,20 @@ const PLUGINS = [ allChunks: true } ), + + // Generate index.html for app with link and style tags addded + new HtmlWebpackPlugin({ + filename: 'index.html', + minify: PRODUCTION ? { + collapseWhitespace: true, + minifyJS: true, + removeComments: true, + removeRedundantAttributes: true + } : false, + template: path.resolve(__dirname, 'index_template.html'), + }), +]; + const PROD_PLUGINS = [ new webpack.optimize.UglifyJsPlugin({ compress: {