Skip to content

Commit 6b8dfb9

Browse files
author
sanex3339
committed
Use html-webpack-plugin for template loading
1 parent e11ed3e commit 6b8dfb9

File tree

5 files changed

+378
-6
lines changed

5 files changed

+378
-6
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@
5252
"url-loader": "1.0.1",
5353
"webpack": "4.4.1",
5454
"webpack-cli": "2.0.13"
55+
},
56+
"devDependencies": {
57+
"html-webpack-plugin": "^3.2.0"
5558
}
5659
}

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ app.use('/static/images', express.static(__dirname + '/public/images'));
1717
app.use('/static/semantic', express.static(__dirname + '/public/semantic'));
1818

1919
app.get('/', function (req, res) {
20-
res.sendFile(__dirname + '/templates/index.html');
20+
res.sendFile(__dirname + '/dist/index.html');
2121
});
2222

2323
app.post('/obfuscate', function (req, res) {

templates/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,5 @@ <h3 class="ui header">Support project:</h3>
618618

619619
</div>
620620

621-
<script src="/static/dist/bundle.js"></script>
622-
623621
</body>
624622
</html>

webpack.conf.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const ExtractTextPlugin = require('extract-text-webpack-plugin');
22

33
const extractLESS = new ExtractTextPlugin('stylesheets/[name].css');
4+
const HtmlWebpackPlugin = require('html-webpack-plugin');
45

56
module.exports = {
67
context: __dirname,
@@ -35,6 +36,10 @@ module.exports = {
3536
]
3637
},
3738
plugins: [
39+
new HtmlWebpackPlugin({
40+
template: './templates/index.html',
41+
hash: true
42+
}),
3843
extractLESS
3944
]
4045
};

0 commit comments

Comments
 (0)