-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgulpfile.js
61 lines (52 loc) · 1.53 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
var destDir = 'bin';
var gulp = require('gulp');
var bower = require('gulp-bower');
var concat = require('gulp-concat');
var less = require('gulp-less');
var debug = require( 'gulp-debug' );
var clean = require( 'gulp-clean' );
var livereload = require('gulp-livereload');
var csscomb = require('gulp-csscomb');
var jscs = require('gulp-jscs');
var jshint = require('gulp-jshint');
var runSequence = require('run-sequence');
gulp.task('default', ['style']);
//CODESTYLE
gulp.task('style', function () {
runSequence('jshint', 'jscs', 'htmlhint', 'csscomb');
}
);
gulp.task('htmlhint', function () {
return gulp.src('client_src/**/*.html')
.pipe(htmlhint('.htmlhintrc'))
.on('error', handleError)
.pipe(htmlhint.reporter());
});
gulp.task('jscs', function () {
return gulp.src('client_src/**/*.js')
.pipe(jscs({
fix: true,
configPath: '.jscs.json'
}).on('error', handleError))
.pipe(gulp.dest(function (file) {
return file.base;
}));
});
gulp.task('jshint', function () {
return gulp.src('client_src/**/*.js')
.pipe(jshint().on('error', handleError))
.pipe(jshint.reporter('default'));
});
gulp.task('csscomb', function () {
return gulp.src('client_src/**/*.less')
.pipe(csscomb().on('error', handleError))
.pipe(gulp.dest(function (file) {
return file.base;
}));
});
//CODESTYLE//
function handleError(err) {
console.log(err.toString());
this.emit('end');
return this;
}