-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
executable file
·62 lines (51 loc) · 1.27 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
'use strict';
var gulp = require('gulp'),
$ = require('gulp-load-plugins')();
// because gulp-load-$ loads plugins only with prefix gulp-. Shit.
$.browserSync = require('browser-sync');
var config = {
/* uncomment below if you not need php */
server: {
baseDir: './'
},
startPath: 'examples/basic',
//tunnel: true,
host: 'localhost',
//port: 9000,
logPrefix: 'Frontend'
};
var notifyConfig = {
title: '<%= error.plugin %>',
message: '<%= error.message %> in file <%= error.fileName %>:<%= error.lineNumber %>'
};
gulp.task('jcarouselSwipe:build', function () {
gulp.src('src/*.js')
.pipe($.plumber({
errorHandler: $.notify.onError(notifyConfig)
}))
.pipe(gulp.dest('dist/'))
.pipe($.uglify())
.pipe($.rename({
extname: '.min.js'
}))
.pipe(gulp.dest('dist/'))
.pipe($.browserSync.reload({stream: true}));
});
gulp.task('build', [
'jcarouselSwipe:build'
]);
gulp.task('watch', function () {
$.watch(['src/*.js'], function (event, cb) {
gulp.start('jcarouselSwipe:build');
});
$.watch(['examples/**/*.*'], function() {
$.browserSync.reload();
});
});
gulp.task('webserver', function () {
$.browserSync(config);
});
gulp.task('clean', function (cb) {
rimraf('dist/', cb);
});
gulp.task('default', ['build', 'webserver', 'watch']);