-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.min.coffee
32 lines (29 loc) · 1.12 KB
/
webpack.min.coffee
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
webpack = require('webpack')
config = require('./webpack.config')
fs = require('fs')
ExtractTextPlugin = require 'extract-text-webpack-plugin'
fontName = 'fonts/[name].[ext]'
module.exports =
entry:
vendor: []
main: ['./src/main']
output:
path: 'build/'
filename: '[name].[chunkhash:8].js'
resolve: config.resolve
module:
loaders: [
{test: /\.coffee$/, loader: 'coffee'}
{test: /\.less$/, loader: ExtractTextPlugin.extract('style-loader', 'css?importLoaders=1!autoprefixer!less')}
{test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css?importLoaders=1!autoprefixer')}
{test: /\.(eot|woff|woff2|ttf|svg|png)((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 100, name: fontName}}
]
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.[chunkhash:8].js')
new (webpack.optimize.UglifyJsPlugin)(sourceMap: false)
new ExtractTextPlugin("style.[chunkhash:8].css")
->
@plugin 'done', (stats) ->
content = JSON.stringify(stats.toJson().assetsByChunkName, null, 2)
fs.writeFileSync 'build/assets.json', content
]