forked from nervgh/angular-file-upload
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (67 loc) · 2.26 KB
/
gulpfile.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
63
64
65
66
67
68
69
70
71
72
73
var pkg = require('./package.json');
// https://github.com/gulpjs/gulp/blob/master/docs/README.md
var gulp = require('gulp');
// http://webpack.github.io/docs/
var webpack = require('webpack');
// https://github.com/shama/webpack-stream
var webpackStream = require('webpack-stream');
gulp.task(
pkg.name + '/build',
function() {
return gulp
.src('./src/index.js')
.pipe(webpackStream({
module: {
loaders: [
// https://github.com/babel/babel-loader
{test: /\.js$/, loader: 'babel'},
// https://github.com/webpack/json-loader
{test: /\.json$/, loader: 'json'},
// https://github.com/webpack/html-loader
{test: /\.html$/, loader: 'html'}
]
},
plugins: [
// http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
// http://webpack.github.io/docs/list-of-plugins.html#bannerplugin
new webpack.BannerPlugin(
'/*\n' +
' ' + pkg.name + ' v' + pkg.version + '\n' +
' ' + pkg.homepage + '\n' +
'*/\n'
, {
entryOnly: true,
raw: true
})
],
devtool: 'source-map',
debug: true,
output: {
library: pkg.name,
libraryTarget: 'umd',
filename: pkg.name + '.min.js'
}
}))
.pipe(gulp.dest('./dist'));
}
);
gulp.task(
pkg.name + '/watch', function() {
return gulp
.watch(
[
'./src/**/*.js',
'./src/**/*.json',
'./src/**/*.html'
],
[
pkg.name + '/build'
]
);
}
);