Skip to content
This repository has been archived by the owner on May 12, 2019. It is now read-only.

Commit

Permalink
Auto-generate main html
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Sep 17, 2016
1 parent 418d0c9 commit a82ffee
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 16 deletions.
3 changes: 3 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appMountId": "app"
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"webpack"
],
"dependencies": {
"html-webpack-harddisk-plugin": "0.0.2",
"html-webpack-plugin": "~2.22.0",
"html-webpack-template": "~5.1.1",
"react": "~15.3.1",
"react-dom": "~15.3.1"
},
Expand Down
6 changes: 3 additions & 3 deletions src/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import ReactDOM from 'react-dom'
import React from 'react'
import App from './App'

const rootEl = document.getElementById('root')
const el = document.getElementById('app')
ReactDOM.render(
<AppContainer>
<App />
</AppContainer>,
rootEl
el
)

if (module.hot) {
Expand All @@ -21,7 +21,7 @@ if (module.hot) {
<AppContainer>
<NextApp />
</AppContainer>,
rootEl
el
)
})
}
13 changes: 0 additions & 13 deletions src/www/index.html

This file was deleted.

11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
'use strict'

const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const autoprefixer = require('autoprefixer')
const pkg = require('./package.json')
const webpack = require('webpack')
Expand All @@ -20,6 +22,15 @@ module.exports = {
modulesDirectories: ['node_modules']
},
plugins: [
new HtmlWebpackPlugin(Object.assign({}, config, {
template: require('html-webpack-template'),
alwaysWriteToDisk: true,
minify: {
removeComments: true,
collapseWhitespace: true
}
})),
new HtmlWebpackHarddiskPlugin(),
new ExtractTextPlugin('css/bundle.css', { allChunks: true }),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
Expand Down
8 changes: 8 additions & 0 deletions webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict'

const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin')
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const autoprefixer = require('autoprefixer')
const config = require('./config.json')
const webpack = require('webpack')
const path = require('path')

Expand All @@ -22,6 +25,11 @@ module.exports = {
modulesDirectories: ['node_modules']
},
plugins: [
new HtmlWebpackPlugin(Object.assign({}, config, {
template: require('html-webpack-template'),
alwaysWriteToDisk: true
})),
new HtmlWebpackHarddiskPlugin(),
new webpack.HotModuleReplacementPlugin(),
new BrowserSyncPlugin(
// BrowserSync options
Expand Down

0 comments on commit a82ffee

Please sign in to comment.