forked from thomasvaeth/instafetch.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (30 loc) · 926 Bytes
/
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
'use strict';
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var eslint = require('gulp-eslint');
var rename = require('gulp-rename');
var strip = require('gulp-strip-comments');
var uglify = require('gulp-uglify');
gulp.task('lint', function() {
return gulp.src('./src/**/*.js')
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('bundleScripts', function() {
return gulp.src('./src/instafetch.js')
.pipe(browserify())
.pipe(strip())
.pipe(gulp.dest('./dist'));
});
gulp.task('minifyBundle', ['bundleScripts'], function() {
return gulp.src('./dist/instafetch.js')
.pipe(uglify())
.pipe(rename('instafetch.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', ['lint', 'minifyBundle']);
gulp.task('watch', function() {
gulp.watch('./src/**/*.js', ['lint', 'minifyBundle']);
});
gulp.task('default', ['build', 'watch']);