-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathgulpfile.js
69 lines (62 loc) · 1.56 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
var gulp = require('gulp'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
csslint = require('gulp-csslint'),
stylish = require('jshint-stylish'),
paths = {
css: ['styles/all/theme/*.css', '!styles/all/theme/*.min.css'],
js: ['styles/all/template/js/*.js', '!styles/all/template/js/*.min.js'],
};
// Lint JS
gulp.task('jshint', function() {
return gulp.src(paths.js)
.pipe(jshint({
'globals': {
'$': true,
'is_ie': true,
'form_name': true,
'text_name': true,
'baseHeight': true,
'storeCaret': true,
'bbfontstyle': true,
'insert_text': true,
}
}))
.pipe(jshint.reporter(stylish));
});
// Minify JS
gulp.task('js', function() {
return gulp.src(paths.js)
.pipe(rename({suffix: '.min'} ))
.pipe(uglify())
.pipe(gulp.dest('styles/all/template/js/'));
});
// Lint CSS
gulp.task('csslint', function() {
return gulp.src(paths.css)
.pipe(csslint({
'ids': false,
'important': false,
'box-model': false,
'box-sizing': false
}))
.pipe(csslint.reporter());
});
// Minify CSS
gulp.task('css', function() {
return gulp.src(paths.css)
.pipe(rename({suffix: '.min'} ))
.pipe(minifycss())
.pipe(gulp.dest('styles/all/theme/'));
});
// Watch CSS and JS files with $ gulp watch
gulp.task('watch', function() {
gulp.watch(paths.js, ['js']);
gulp.watch(paths.css, ['css']);
});
// Run linting tasks with $ gulp lint
gulp.task('lint', ['jshint', 'csslint']);
// Run default tasks with $ gulp
gulp.task('default', ['js', 'css']);