-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.min.coffee
34 lines (31 loc) · 1.1 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
33
34
webpack = require('webpack')
config = require('./webpack.config')
fs = require('fs')
ExtractTextPlugin = require 'extract-text-webpack-plugin'
fontName = '[name].[ext]'
module.exports =
entry:
vendor: []
main: ['./src/main', './src/main.css']
output:
path: 'build/'
filename: '[name].[chunkhash:8].js'
publicPath: './build/'
resolve: config.resolve
module:
loaders: [
{test: /\.coffee$/, loader: 'coffee'}
{test: /\.less$/, loader: 'style!css!less'}
{test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css')}
{test: /\.json$/, loader: 'json'}
{test: /\.(eot|woff|woff2|ttf|svg|jpg)((\?|\#)[\?\#\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
]