forked from JetBrains/kotlin-web-site
-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
102 lines (88 loc) · 2.13 KB
/
webpack.config.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
'use strict';
var path = require('path');
var fs = require('fs');
var Webpack = require('webpack');
var WebpackExtractTextPlugin = require('extract-text-webpack-plugin');
var LiveReloadPlugin = require('webpack-livereload-plugin');
var extend = require('extend');
var autoprefixer = require('autoprefixer');
var isProduction = process.env.NODE_ENV === 'production';
var webpackConfig = {
entry: {
'common': 'page/common.js',
'index': 'page/index.js',
'events': 'page/events/index.js',
'videos': 'page/videos.js',
'grammar': 'page/grammar.js',
'community': 'page/community/community.js',
'styles': 'styles.scss',
'pdf': 'page/pdf.js'
},
output: {
path: path.join(__dirname, '_assets'),
publicPath: '/_assets/',
filename: '[name].js'
},
resolve: {
modulesDirectories: ['node_modules', './static/js', './static/css']
},
devtool: !isProduction ? 'sourcemap' : false,
module: {
loaders: [
{
test: /\.css$/,
loader: WebpackExtractTextPlugin.extract([
'css',
'postcss'
].join('!'))
},
{
test: /\.scss$/,
loader: WebpackExtractTextPlugin.extract([
'css',
'postcss',
'resolve-url?keepQuery',
'sass?sourceMap'
].join('!'))
},
{
test: /\.(woff|ttf)$/,
loader: 'file?name=[path][name].[ext]'
},
{
test: /\.twig$/,
loader: 'nunjucks-loader'
},
{
test: /\.svg/,
loaders: [
'url',
'svg-fill'
]
},
{
test: /\.(jpe?g|png|gif)$/,
loader: 'advanced-url?limit=10000&name=[path][name].[ext]'
}
]
},
postcss: [
autoprefixer({browsers: ['last 2 versions']})
],
plugins: [
new Webpack.optimize.CommonsChunkPlugin({
name: 'default',
minChunks: 3
}),
new Webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
new WebpackExtractTextPlugin('[name].css'),
new LiveReloadPlugin({
appendScriptTag: false
})
]
};
module.exports = webpackConfig;