forked from longbill/jquery-date-range-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (46 loc) · 1.62 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
(function () {
'use strict';
var gulp = require('gulp'),
gutil = require("gulp-util"),
del = require('del'),
beautify = require("gulp-jsbeautifier"),
uglify = require("gulp-uglify"),
minifyCSS = require("gulp-minify-css"),
rename = require("gulp-rename"),
header = require('gulp-header');
var pkg = require('./package.json');
var banner = ['/**',
' * <%= pkg.name %>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('beautify', function() {
gulp.src(['./src/*.css', './src/*.js'])
.pipe(beautify())
.pipe(gulp.dest('./src'));
});
gulp.task('dist:clean', function () {
del.sync('./dist', {force: true});
});
gulp.task('dist:styles', ['dist:clean'], function () {
return gulp.src('./src/*.css')
.pipe(minifyCSS())
.pipe(rename('daterangepicker.min.css'))
.pipe(gulp.dest('./dist'))
.on('error', gutil.log)
});
gulp.task('dist:script', ['dist:clean'], function () {
return gulp.src('./src/*.js')
.pipe(uglify())
.pipe(rename('jquery.daterangepicker.min.js'))
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('./dist'))
.on('error', gutil.log)
});
gulp.task('default', ['dist:clean', 'dist:styles', 'dist:script'], function (cb) {
gutil.log('Info :', gutil.colors.green('Distribution files are ready!'));
cb(null)
});
})();