-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.js
72 lines (71 loc) · 1.73 KB
/
build.js
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
64
65
66
67
68
69
70
71
72
import Metalsmith from 'metalsmith';
import layouts from 'metalsmith-layouts';
import inPlace from 'metalsmith-in-place';
import markdown from 'metalsmith-markdown';
import sass from 'metalsmith-sass';
import htmlMinifier from 'metalsmith-html-minifier';
import googleAnalytics from 'metalsmith-google-analytics';
import babel from 'metalsmith-babel';
import Mwebpack from 'metalsmith-webpack';
import webpack from 'webpack';
Metalsmith(__dirname)
//.use(babel())
.use(sass({
outputDir: 'css',
sourceMapContents: true
}))
.use(markdown({
gfm: true
}))
.use(layouts({
engine: 'liquid',
directory: 'layouts',
includeDir: 'layouts/includes'
}))
.use(inPlace({
engine: 'liquid',
pattern: '**/*.html',
includeDir: 'layouts/includes'
}))
.use(googleAnalytics('UA-46065410-1'))
.use(Mwebpack({
context: __dirname + '/src/js/',
entry: {
benchmarks: './benchmarks.js',
index: './index.js',
},
output: {
path: __dirname + '/build/js/',
filename: '[name].js'
},
resolveLoader: {
root: __dirname + '/node_modules',
modulesDirectories: [(__dirname + "/node_modules")]
},
module: {
loaders: [
{
loader: "babel",
include: [
__dirname + '/src',
],
query: {
presets: ['es2015']
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
fetch: 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
}))
.use(htmlMinifier())
.build(err => { if (err) { console.log(err) }});