This repository has been archived by the owner on Feb 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
gulpfile.js
65 lines (59 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
56
57
58
59
60
61
62
63
64
65
var gulp = require('gulp');
var minifyCss = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var rename = require("gulp-rename");
var livereload = require('gulp-livereload');
/**
* Default Task
*/
gulp.task('default', ['css', 'js']);
/**
* Style task
*/
gulp.task('css', function() {
var autoprefixerOptions = {
browsers: [
'last 5 versions',
'last 20 firefox versions',
'last 20 chrome versions',
'ie >= 8',
],
remove: false,
};
gulp.src('./lib/css/*.css')
.pipe(minifyCss({
compatibility: 'ie8'
}))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(rename('candlestick.min.css'))
.pipe(gulp.dest('dist'));
gulp.src('./lib/css/*.css')
.pipe(sourcemaps.init())
.pipe(minifyCss({
compatibility: 'ie8'
}))
.pipe(autoprefixer(autoprefixerOptions))
.pipe(sourcemaps.write())
.pipe(rename('candlestick.map.css'))
.pipe(gulp.dest('dist'));
});
/**
* Scripts task
*/
gulp.task('js', function() {
return gulp.src('./lib/js/*.js')
.pipe(uglify())
.pipe(rename('candlestick.min.js'))
.pipe(gulp.dest('dist'));
});
/**
* Watch & live reload
*/
gulp.task('watch', function() {
gulp.watch(['./lib/js/*.js', './lib/css/*.css'], ['css', 'js']).on('change', function(e) {
livereload.changed(e.path);
console.log('Update file -> ' + e.path);
});
});