forked from onaci/leaflet-velocity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (40 loc) · 1.22 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
const gulp = require('gulp');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
const concatCss = require('gulp-concat-css');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const cssNano = require('gulp-cssnano');
// Concatenate & Minify src and dependencies
gulp.task('scripts', function() {
return gulp.src([
'src/js/**.js'
])
.pipe(concat('leaflet-velocity.js'))
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('dist'))
.pipe(rename('leaflet-velocity.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
gulp.task('concatCss', function () {
return gulp.src('./src/css/*.css')
.pipe(concatCss('leaflet-velocity.css'))
.pipe(gulp.dest('./dist'));
});
gulp.task('cssNano', ['concatCss'], function() {
gulp.src('./dist/leaflet-velocity.css')
.pipe(cssNano())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./dist'));
});
// Default Task
gulp.task('default', ['scripts', 'concatCss', 'cssNano', 'watch']);
// Watch Files For Changes
gulp.task('watch', function() {
// We watch both JS and HTML files.
gulp.watch('src/js/*.js', ['scripts']);
gulp.watch('src/css/*.css', ['concatCss', 'cssNano']);
});