-
Notifications
You must be signed in to change notification settings - Fork 102
/
gulpfile.js
76 lines (63 loc) · 1.58 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
var gulp = require('gulp');
var webpack = require('gulp-webpack');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var mocha = require('gulp-mocha');
var source = require('vinyl-source-stream');
var regularify = require('regularify');
var browserify = require('browserify');
var pkg = require("./package.json");
var wpConfig = {
output: {
filename: "client.bundle.js",
library: "puer",
libraryTarget: "umd"
},
module: {
loaders: [
{ test: /\.html$/, loader: "text" }
]
}
}
gulp.task('client', function() {
browserify(['./src/client/client.js'], {})
.transform(regularify({
END: '}',
BEGIN: '{',
rglExt: ['html'],
rglcExt: ['rglc']
}))
.bundle()
.on('error', function(err){
console.log('!!!!!!!!!!!!' + err)
// kao....
done(null)
this.end();
})
.pipe(source('bundle.js'))
.pipe(gulp.dest('src/client'))
// gulp.src("client/client.js")
// .pipe(webpack(wpConfig))
// .pipe(gulp.dest('./client'))
// .on("error", function(err) {
// throw err
// })
});
gulp.task('jshint', function(){
// jshint
gulp.src(['libs/**/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'))
})
gulp.task('watch', ["client", 'jshint'], function() {
gulp.watch(['libs/**/*.js'], ['jshint']);
gulp.watch(['client/*.js'], ['client']);
})
gulp.task('default', ['watch']);
gulp.task('mocha', function() {
return gulp.src(['test/spec/*.js'])
.pipe(mocha({ reporter: 'spec' }))
.on('error', function() {
console.log('\u0007');
})
});