diff --git a/src/template-config.js b/src/template-config.js
index 33cd26ca7..4495f442b 100644
--- a/src/template-config.js
+++ b/src/template-config.js
@@ -1,4 +1,16 @@
+/**
+ * Default options for the html-webpack-plugin HTML renderer
+ *
+ * See https://github.com/ampedandwired/html-webpack-plugin#configuration
+ * for possible options. Any other options will be available to the template
+ * under `htmlWebpackPlugin.options`
+ */
+
module.exports = {
+ // html-webpack-plugin options
+ template: './src/template.ejs',
+ inject: false,
+
// Search and metadata
title: 'Imagine, Program, Share',
description:
diff --git a/src/template.html b/src/template.ejs
similarity index 84%
rename from src/template.html
rename to src/template.ejs
index 440e3de6e..0a0fcdcd6 100644
--- a/src/template.html
+++ b/src/template.ejs
@@ -6,25 +6,25 @@
-
+
-
Scratch - <%= htmlWebpackPlugin.options.config.title %>
+ Scratch - <%= htmlWebpackPlugin.options.title %>
-
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -35,15 +35,17 @@
@@ -65,7 +67,7 @@
loc = loc.split('-')[0];
}
if (typeof window._messages[loc] !== 'undefined') {
- var localizedTitle = window._messages[loc]['general.' + '<%= htmlWebpackPlugin.options.config.title %>'.toLowerCase()] || '';
+ var localizedTitle = window._messages[loc]['general.' + '<%= htmlWebpackPlugin.options.title %>'.toLowerCase()] || '';
if (localizedTitle.length > 0) {
document.title = 'Scratch - ' + localizedTitle;
}
diff --git a/webpack.config.js b/webpack.config.js
index 1b07dd079..b24e76287 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,5 +1,6 @@
var autoprefixer = require('autoprefixer');
var CopyWebpackPlugin = require('copy-webpack-plugin');
+var defaults = require('lodash.defaults');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var gitsha = require('git-bundle-sha');
var path = require('path');
@@ -102,14 +103,11 @@ module.exports = {
plugins: [
new VersionPlugin({length: 5})
].concat(routes.map(function (route) {
- return new HtmlWebpackPlugin({
+ return new HtmlWebpackPlugin(defaults({}, require('./src/template-config.js'), {
title: route.title,
filename: route.name + '.html',
- template: './src/template.html',
- route: route,
- config: require('./src/template-config.js'),
- inject: false
- });
+ route: route
+ }));
})).concat([
new CopyWebpackPlugin([
{from: 'static'},