mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Generate index.html using webpack
Allows webpack to generate the js and css tags rather than hard coding them in
This commit is contained in:
parent
bd2895afa0
commit
1b52749f9d
@ -1,4 +1,4 @@
|
|||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -10,16 +10,7 @@
|
|||||||
|
|
||||||
<title>ascribe</title>
|
<title>ascribe</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="<%= BASE_URL %>static/css/main.css">
|
|
||||||
<% DEBUG && print('<link rel="stylesheet" href="' + BASE_URL + 'static/css/maps/main.css.map">') %>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.BASE_URL = '<%= BASE_URL %>';
|
|
||||||
window.SERVER_URL = '<%= SERVER_URL %>';
|
|
||||||
window.API_ENDPOINT = '<%= API_ENDPOINT %>';
|
|
||||||
<% DEBUG && print('window.DEBUG = true'); %>
|
|
||||||
<% DEBUG && print('window.CREDENTIALS = \'' + CREDENTIALS + '\''); %>
|
|
||||||
</script>
|
|
||||||
<!-- Typekit gibson font -->
|
<!-- Typekit gibson font -->
|
||||||
<script src="https://use.typekit.net/gma2yhj.js"></script>
|
<script src="https://use.typekit.net/gma2yhj.js"></script>
|
||||||
<script>
|
<script>
|
||||||
@ -44,8 +35,5 @@
|
|||||||
s.src='https://widget.intercom.io/widget/{app_id}';
|
s.src='https://widget.intercom.io/widget/{app_id}';
|
||||||
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
|
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- actual app -->
|
|
||||||
<script src="<%= BASE_URL %>static/js/app.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -84,6 +84,7 @@
|
|||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.8.5",
|
||||||
"history": "1.17.0",
|
"history": "1.17.0",
|
||||||
|
"html-webpack-plugin": "^2.19.0",
|
||||||
"invariant": "^2.1.1",
|
"invariant": "^2.1.1",
|
||||||
"isomorphic-fetch": "^2.0.2",
|
"isomorphic-fetch": "^2.0.2",
|
||||||
"moment": "^2.10.6",
|
"moment": "^2.10.6",
|
||||||
|
@ -8,6 +8,7 @@ const webpack = require('webpack');
|
|||||||
const autoPrefixer = require('autoprefixer');
|
const autoPrefixer = require('autoprefixer');
|
||||||
const combineLoaders = require('webpack-combine-loaders');
|
const combineLoaders = require('webpack-combine-loaders');
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
require('dotenv').load({ silent: true });
|
require('dotenv').load({ silent: true });
|
||||||
|
|
||||||
@ -38,6 +39,20 @@ const PLUGINS = [
|
|||||||
allChunks: true
|
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 = [
|
const PROD_PLUGINS = [
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: {
|
||||||
|
Loading…
Reference in New Issue
Block a user