forked from sahat/satellizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (38 loc) · 1.17 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var plumber = require('gulp-plumber');
var complexity = require('gulp-complexity');
var header = require('gulp-header');
var pkg = require('./package.json');
var banner = ['/**',
' * Satellizer <%= pkg.version %>',
' * (c) 2016 <%= pkg.author.name %>',
' * License: <%= pkg.license %>',
' */',
''].join('\n');
gulp.task('minify', function() {
return gulp.src('satellizer.js')
.pipe(plumber())
.pipe(uglify())
.pipe(header(banner, { pkg: pkg }))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('.'));
});
gulp.task('copy', ['minify'], function() {
return gulp.src('satellizer.js')
.pipe(gulp.dest('examples/client/vendor'))
.pipe(gulp.dest('examples/ionic/www/lib'));
});
gulp.task('php', function() {
return gulp.src('examples/client/**/*.*')
.pipe(gulp.dest('examples/server/php/public'));
});
gulp.task('complexity', function() {
return gulp.src('satellizer.js')
.pipe(complexity());
});
gulp.task('watch', function() {
gulp.watch('satellizer.js', ['copy', 'php', 'minify']);
});
gulp.task('default', ['copy', 'php', 'watch']);