forked from teobais/percircle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (43 loc) · 1.42 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
var gulp = require('gulp');
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish'),
watch = require('gulp-watch'),
cssnano = require('gulp-cssnano'),
rtlcss = require('gulp-rtlcss'),
del = require('del'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
jshintSummary = require('jshint-stylish-summary');
require('gulp-stats')(gulp);
gulp.task('cleanjs', function() {
return del(['dist/js']);
});
gulp.task('cleancss', function() {
return del(['dist/css']);
});
gulp.task('watch', function() {
watch("src/js/**/*.js")
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('js', ['cleanjs'], function() {
return gulp.src('./src/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshintSummary.collect())
.on('end', jshintSummary.summarize())
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
gulp.task('css', ['cleancss'], function() {
return gulp.src('src/css/*.css')
.pipe(cssnano())
.pipe(gulp.dest('dist/css'))
// Till this point, we've only managed to minimize the css.
// Now, take the minimized css and also generate an rtl version of it.
.pipe(rtlcss())
.pipe(rename({ suffix: '-rtl' }))
.pipe(gulp.dest('dist/css'));
});
// 'js' and 'css' will run concurrently, but only after 'clean' is done.
gulp.task('default', ['js', 'css']);