-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
44 lines (39 loc) · 1.26 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const SpritesmithPlugin = require('webpack-spritesmith');
module.exports = {
entry: './cv.js',
output: {
path: path.join(__dirname, 'build'),
publicPath: '',
filename: 'bundle.js'
},
module: {
loaders: [
{ test: /\.pug$/, loader: 'pug' },
{ test: /\.styl$/, loader: ExtractTextPlugin.extract('!css!stylus') },
{ test: /\.(png|svg|ttf|eot|woff|woff2)$/, loader: 'file?name=[path][name].[ext]' }
]
},
resolve: {
modulesDirectories: ["web_modules", "node_modules", "icons"]
},
plugins: [
new HtmlWebpackPlugin({template: "index.pug"}),
new ExtractTextPlugin('[name].css', {allChunks: true}),
new SpritesmithPlugin({
src: {
cwd: path.resolve(__dirname, './blocks/icon/icons'),
glob: '*.png'
},
target: {
image: path.resolve(__dirname, 'blocks/icon/sprite.png'),
css: path.resolve(__dirname, 'blocks/icon/sprite.styl')
},
apiOptions: {
cssImageRef: "sprite.png"
}
})
],
};