From 6d8e01b476e9e80e356c1042b36df9601a1b36b4 Mon Sep 17 00:00:00 2001 From: Timothy Farrell Date: Thu, 11 Jan 2018 16:10:51 -0600 Subject: [PATCH] Use HTML webpack plugin for one less thing to worry about. --- packages/gallery/package.json | 1 + .../gallery/src/{index.html => index.template.html} | 4 ++-- packages/gallery/webpack.config.js | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) rename packages/gallery/src/{index.html => index.template.html} (58%) diff --git a/packages/gallery/package.json b/packages/gallery/package.json index 8940bf9..3c9f422 100644 --- a/packages/gallery/package.json +++ b/packages/gallery/package.json @@ -35,6 +35,7 @@ "styletron-utils": "^2.5.4" }, "devDependencies": { + "html-webpack-plugin": "^2.30.1", "webpack": "~3.8.1", "webpack-dev-server": "~2.9.2" } diff --git a/packages/gallery/src/index.html b/packages/gallery/src/index.template.html similarity index 58% rename from packages/gallery/src/index.html rename to packages/gallery/src/index.template.html index c614c52..db870cd 100644 --- a/packages/gallery/src/index.html +++ b/packages/gallery/src/index.template.html @@ -1,10 +1,10 @@ + - + Photos - diff --git a/packages/gallery/webpack.config.js b/packages/gallery/webpack.config.js index 292e629..36cd3e8 100644 --- a/packages/gallery/webpack.config.js +++ b/packages/gallery/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path'); const webpack = require('webpack'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { context: path.resolve(__dirname, './src'), @@ -31,10 +32,12 @@ module.exports = { ] }, plugins: [ - new webpack.DefinePlugin({ - __DEV__: true - }), - new ExtractTextPlugin('app.css', { allChunks: true }) + new webpack.DefinePlugin({ __DEV__: true }), + new ExtractTextPlugin('app.css', { allChunks: true }), + new HtmlWebpackPlugin({ + template: 'index.template.html', + inject: 'body' + }) ], devtool: 'source-map' };