-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
104 lines (88 loc) · 2.3 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
var path = require('path');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var csslint = require('gulp-csslint');
var minifyCSS = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps');
var coveralls = require('gulp-coveralls');
var less = require('gulp-less');
var phantom = require('gulp-phantom');
var del = require('del');
gulp.task('dist-clean', ['clean'], function() {
'use strict';
del([
'config.json',
'node_modules',
'coverage',
'public/components'
], function(err, delfiles) {
if (err) {
return err;
}
return delfiles;
});
});
gulp.task('clean', function() {
'use strict';
var dest = path.join(__dirname, 'public', 'css', 'app.css');
del([dest, 'log'], function(err, delfiles) {
if (err) {
return err;
}
return delfiles;
});
});
gulp.task('csslint', function() {
'use strict';
return gulp.src('./public/css/**/*.css')
.pipe(csslint('.csslintrc'))
.pipe(csslint.reporter())
.pipe(csslint.failReporter());
});
gulp.task('minify-css', ['less'], function() {
'use strict';
return gulp.src('./public/css/app.css')
.pipe(sourcemaps.init())
.pipe(minifyCSS({
//keepBreaks: true
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('jshint', function() {
'use strict';
return gulp.src([
'./test/**/*.js',
'./lib/**/*.js',
'index.js',
'gulpfile.js'
])
.pipe(jshint())
.pipe(jshint.reporter('jshint-reporter-jscs'))
.pipe(jshint.reporter('fail'));
});
gulp.task('less', function() {
'use strict';
var dest = path.join(__dirname, 'public', 'css');
return gulp.src('./src/less/*.less')
.pipe(less({
paths: [path.join(__dirname, 'src', 'less')]
}))
.pipe(gulp.dest(dest));
});
gulp.task('phantom', function() {
'use strict';
return gulp.src('./test/*.js')
.pipe(phantom())
.pipe(gulp.dest('./test'));
});
gulp.task('coveralls', function() {
"use strict";
gulp.src('./coverage/**/lcov.info')
.pipe(coveralls());
});
gulp.task('default', [
'clean',
'jshint',
'less',
'csslint',
], function() {});