-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
39 lines (33 loc) · 1.2 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 fs = require('fs');
var json = JSON.parse(fs.readFileSync('./package.json'));
var version = json.version;
var gulp = require('gulp');
var rename = require('gulp-rename');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var zip = require('gulp-zip');
gulp.task('default', ['js', 'package', 'update-demo']);
gulp.task('js', ['pop-under']);
gulp.task('pop-under', function(done) {
gulp.src('./src/pop-under.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'))
.pipe(rename({basename: 'show-promote', extname: '.js'}))
.pipe(gulp.dest('./dist'))
.pipe(uglify({preserveComments: 'none', mangle:false}))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('./dist'))
.on('end', done);
});
gulp.task('package', function(done) {
gulp.src('./dist/*')
.pipe(zip('popunder-' + version + '.zip'))
.pipe(gulp.dest('./docs/download'))
.on('end', done);
});
gulp.task('update-demo', function(done) {
gulp.src('./dist/show-promote.min.js')
.pipe(gulp.dest('./docs/js'))
.on('end', done);
});