forked from markgoodyear/scrollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (34 loc) · 1.01 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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var header = require('gulp-header');
var rename = require('gulp-rename');
var del = require('del');
var pkg = require('./package.json');
// Banner
var banner = ['/*!',
' * <%= pkg.name %> v<%= pkg.version %>',
' * Url: <%= pkg.homepage %>',
' * Copyright (c) <%= pkg.author.name %> — <%= pkg.author.twitter %> — <%= pkg.author.url %>',
' * License: <%= pkg.license.name %>',
' */',
''].join('\n');
// Clean
gulp.task('clean', function(cb) {
del(['dist/*.js'], cb);
});
// Default task
gulp.task('default', function() {
return gulp.src('src/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('dist'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify({ preserveComments: 'some' }))
.pipe(gulp.dest('dist'));
});
// Watch
gulp.task('watch', function() {
gulp.watch(config.src, ['default']);
});