-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
85 lines (69 loc) · 2.22 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
78
79
80
81
82
83
84
85
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var strip = require('gulp-strip-comments');
var uglify = require('gulp-uglify')
var insert = require('gulp-insert');
var browserify = require('gulp-browserify');
var rename = require('gulp-rename');
var lesshint = require('gulp-lesshint');
var less = require('gulp-less');
var fs = require('fs');
var paths = {
jsSrc: ['src/*.js', 'src/lib/*.js'],
clientJsSrc: 'src/web/js/*.js',
clientLessSrc: 'src/web/css/*.less',
licenceSrc: 'src/header.js',
dist: './',
};
var licence = fs.readFileSync(paths.licenceSrc);
gulp.task('js:lint', function() {
return gulp.src(paths.jsSrc, { base: paths.srcBase })
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('client:js', ['client:js:lint']);
gulp.task('client:js:lint', function() {
return gulp.src(paths.clientJsSrc, { base: paths.srcBase })
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
/*gulp.task('js:compile', ['js:compile:auto', 'js:compile:main']);
gulp.task('js:compile:main', ['js:lint'], function() {
return gulp.src(paths.mainSrc, { base: paths.srcBase })
.pipe(gulp.dest(paths.dest))
.pipe(uglify())
.pipe(insert.prepend(licence))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(paths.dest));
});
gulp.task('js:compile:auto', ['js:lint'], function() {
return gulp.src(paths.autoSrc, { base: paths.srcBase })
.pipe(browserify())
.pipe(strip())
.pipe(insert.prepend(licence))
.pipe(gulp.dest(paths.dest))
.pipe(uglify())
.pipe(insert.prepend(licence))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(paths.dest));
});*/
gulp.task('client:css', ['client:css:compile']);
gulp.task('client:css:lint', function() {
return gulp.src(paths.clientLessSrc, { base: paths.srcBase })
.pipe(lesshint())
.pipe(lesshint.reporter());
});
gulp.task('client:css:compile', ['client:css:lint'], function() {
});
gulp.task('watch', function() {
gulp.watch(paths.jsSrc, ['js:lint']);
gulp.watch(paths.clientJsSrc, ['client:js']);
gulp.watch(paths.clientLessSrc, ['client:css']);
});
gulp.task('default', ['js:lint', 'client:js', 'client:css', 'watch']);