-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
77 lines (73 loc) · 2.21 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
74
75
76
77
'use strict';
var gulp = require('gulp')
var webpack = require('gulp-webpack')
var uglify = require('gulp-uglifyjs')
var header = require('gulp-header')
var meta = require('./package.json')
var watch = require('gulp-watch')
var banner = ['/**',
'* Real v${version}',
'* (c) 2015 ${author}',
'* Released under the ${license} License.',
'*/',
''].join('\n')
var bannerVars = {
version : meta.version,
author: meta.author,
license: meta.license
}
gulp.task('watch', function () {
watch(['lib/**', 'real.js'], function () {
gulp.start('default')
})
});
gulp.task('default', function() {
return gulp.src('real.js')
.pipe(webpack({
output: {
library: 'Real',
libraryTarget: 'umd',
filename: 'real.js'
},
module: {
preLoaders: [
{
test: /\.js$/, // include .js files
exclude: /node_modules/, // exclude any and all files in the node_modules folder
loader: "jshint-loader"
}
],
},
jshint: {
// set emitErrors to true to display them as errors
emitErrors: false,
// set failOnHint to true
failOnHint: false,
"browser": true,
"esnext": true,
"globals": {
console: true
},
"globalstrict": true,
"quotmark": false,
"undef": true,
"unused": true,
"asi": true,
"strict": false,
"sub": true,
"shadow": true,
"eqeqeq": false,
"expr": true,
"laxbreak": true,
"newcap": false
}
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
.pipe(uglify('real.min.js', {
mangle: true,
compress: true
}))
.pipe(header(banner, bannerVars))
.pipe(gulp.dest('dist/'))
});