-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.min.coffee
41 lines (38 loc) · 1.9 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
35
36
37
38
39
40
41
ExtractTextPlugin = require 'extract-text-webpack-plugin'
fs = require 'fs'
webpack = require 'webpack'
config = require './webpack.config'
fontName = 'fonts/[name].[ext]'
imageName = 'images/[name].[ext]'
module.exports =
entry:
vendor: []
main: [ './example/main' ]
output:
path: 'build/'
filename: '[name].[chunkhash:8].js'
publicPath: './'
resolve: config.resolve
module:
loaders: [
{test: /\.coffee$/, loader: 'coffee'}
{test: /\.css$/, loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1!autoprefixer?{browsers:["> 1%"]}')}
{test: /\.js$/, exclude: /node_modules/, loader: 'babel'}
{test: /\.jsx$/, exclude: /node_modules/, loader: 'babel'}
{test: /\.less$/, loader: ExtractTextPlugin.extract('style', 'css?importLoaders=1!autoprefixer?{browsers:["> 1%"]}!less')}
{test: /\.(png|jpg|gif)$/, loader: 'url', query: {limit: 2048, name: imageName}}
{test: /\.woff((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 100, minetype: 'application/font-woff', name: fontName}}
{test: /\.woff2((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 100, minetype: 'application/font-woff2', name: fontName}}
{test: /\.ttf((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 100, minetype: "application/octet-stream", name: fontName}}
{test: /\.eot((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 100, name: fontName}}
{test: /\.svg((\?|\#)[\?\#\w\d_-]+)?$/, loader: "url", query: {limit: 10000, minetype: "image/svg+xml", 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
]