-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgulpfile.js
75 lines (62 loc) · 1.59 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
70
71
72
73
74
75
/*
Gulp Setup
*/
var gulp = require('gulp'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
replace = require('gulp-replace'),
sequence = require('gulp-sequence'),
sourcemaps = require('gulp-sourcemaps'),
uglify = require('gulp-uglify'),
fs = require('fs'),
path = require('path'),
rename = require('gulp-rename');
//
// JS
//
src = [
'./src/transition.js',
'./src/transition-init.js'
];
gulp.task('js', function(){
return gulp.src(src)
.pipe(plumber(plumberErrorHandler))
.pipe(sourcemaps.init())
.pipe(concat('barba.transitions.js'))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./example/temp'))
.pipe(concat('barba.transitions.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./dist'))
.pipe(sourcemaps.write('.'));
});
gulp.task('js-dev', function(){
return gulp.src(src)
.pipe(plumber(plumberErrorHandler))
.pipe(sourcemaps.init())
.pipe(concat('barba.transitions.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./example/temp'))
.pipe(sourcemaps.write('.'));
});
//
// Watch
//
gulp.task('watch', function() {
gulp.watch('src/**/*.js', ['js-dev']);
});
//
// Error Handling
//
var plumberErrorHandler = { errorHandler: notify.onError({
title: 'Gulp',
message: 'Error: <%= error.message %>'
})
};
//
// Build Tasks
//
gulp.task('default', sequence(['js-dev', 'watch']));
gulp.task('install', ['js']);