-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
62 lines (58 loc) · 1.32 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
var ExtractText = require('extract-text-webpack-plugin');
var LessClean = require('less-plugin-clean-css');
var HtmlFile = require('html-webpack-plugin');
var Copy = require('copy-webpack-plugin');
var webpack = require('webpack');
var config = {
cache: true,
entry: {
android: './src/android/main.less',
ios: './src/ios/main.less'
},
output: {
path: 'build',
filename: '[name].js',
pathinfo: false
},
module: {
loaders: [
{
test: /\.(png|jpe?g|gif|svg)$/,
loaders: [
'url?limit=8192&name=asset/[name].[ext]',
'image-webpack?{progressive:true, optimizationLevel: 7, interlaced: false, pngquant:{quality: "75-90", speed: 4}}'
]
}, {
test: /\.less$/,
loader: ExtractText.extract(
'css!autoprefixer?browsers=Android >= 4 iOS >= 7' +
'!less?config=lessLoaderCustom'
)
}
]
},
lessLoader: {
lessPlugins: [
new LessClean({advanced: true})
]
},
plugins: [
new ExtractText('[name].css'),
new Copy([
{ from: './asset', to: 'asset' }
])
]
};
var k;
for (k in config.entry) {
config.plugins.push(
new HtmlFile({
filename: k + '.html',
template: 'index.html',
hash: true,
inject: 'head',
chunks: [k]
})
);
}
module.exports = config;