This repository was archived by the owner on Feb 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwebpack.config.js
More file actions
63 lines (56 loc) · 1.54 KB
/
webpack.config.js
File metadata and controls
63 lines (56 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'use strict';
const Path = require('path');
const Fs = require('fs');
const Clean = require('clean-webpack-plugin');
const Compress = require('compression-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const Webpack = require('webpack');
const AutoPrefixer = require('autoprefixer-stylus');
const Axis = require('axis');
const Rupture = require('rupture');
const plugins = [];
plugins.push(new Webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}));
plugins.push(new Clean(['build']));
plugins.push(new Webpack.optimize.OccurenceOrderPlugin(true));
plugins.push(new Compress({
regExp: /\.js$/
}));
plugins.push(new HtmlWebpackPlugin({
templateContent: function (templateParams, compilation) {
const path = templateParams.htmlWebpackPlugin.files.chunks.main.entry;
const template = Fs.readFileSync('layout.template', 'utf8');
return template.replace('{{BUNDLE_NAME}}', path);
},
filename: 'layout.jade'
}));
module.exports = {
context: Path.join(process.cwd(), 'assets'),
entry: {
main: ['./style/main']
},
output: {
path: './build',
filename: '[hash]-[name].js'
},
module: {
loaders: [{
test: /\.styl$/,
include: Path.resolve(process.cwd(), 'assets'),
loader: 'style!css!stylus?paths=node_modules/jeet/stylus/'
}]
},
resolve: {
extensions: ['', '.js', '.styl'],
modulesDirectories: ['node_modules']
},
stylus: {
use: [Rupture(), Axis(), AutoPrefixer({
browsers: ['> 10%', 'Last 2 versions']
})]
},
plugins: plugins
};