-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
52 lines (43 loc) · 1.24 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
'use strict';
var gulp = require('gulp' ),
babel = require('gulp-babel' ),
minify = require('gulp-minify-html'),
rename = require('gulp-rename' ),
uglify = require('gulp-uglify' );
var paths = (function(lib,dist) {
return {
dist: {
base: dist
},
lib: {
es6: [lib + '/*.es6'],
html: [lib + '/*.html'],
images: [lib + '/*.png']
}
};
})('lib','FocusSearch.safariextension');
var logAndIgnore = function(e){console.log(e.toString());this.emit('end');};
gulp.task('babel', function() {
return gulp.src(paths.lib.es6)
.pipe(babel())
.on('error', logAndIgnore)
.pipe(uglify())
.pipe(rename({extname:'.js'}))
.pipe(gulp.dest(paths.dist.base));
});
gulp.task('html', function() {
return gulp.src(paths.lib.html)
.pipe(minify())
.pipe(gulp.dest(paths.dist.base));
});
gulp.task('images', function() {
gulp.src(paths.lib.images)
.pipe(gulp.dest(paths.dist.base));
});
gulp.task('watch', function() {
gulp.watch(paths.lib.es6, ['babel']);
gulp.watch(paths.lib.html, ['html']);
gulp.watch(paths.lib.images, ['images']);
});
gulp.task('compile', ['html', 'images', 'babel'], function(){});
gulp.task('default', ['compile', 'watch'], function(){});