forked from tannerlinsley/nz-toggle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (46 loc) · 1.23 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
53
54
55
56
57
58
59
var gulp = require('gulp');
var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
var stylus = require('gulp-stylus');
var nib = require('nib');
var rename = require('gulp-rename');
var appFolder = './app/';
var prodFolder = './prod/';
gulp.task('watch', watchTask);
// Build Tasks //
gulp.task('js', jsTask);
gulp.task('less', lessTask);
gulp.task('build', ['js', 'less']);
// Default //
gulp.task('default', ['build', 'watch']);
function serveTask() {
server.start({
port: 80,
directory: argv.prod ? './prod' : './app'
});
}
function jsTask() {
gulp.src('./src/nz-toggle.js')
.pipe(ngAnnotate())
.pipe(gulp.dest('./dist/'))
.pipe(uglify())
.pipe(rename('nz-toggle.min.js'))
.pipe(gulp.dest('./dist/'));
}
function lessTask() {
gulp.src('./src/nz-toggle.styl')
.pipe(stylus({
use: nib()
}))
.pipe(gulp.dest('./dist/'));
return gulp.src('./src/nz-toggle.styl')
.pipe(stylus({
use: nib(),
compress: true,
}))
.pipe(rename('nz-toggle.min.css'))
.pipe(gulp.dest('./dist/'));
}
function watchTask() {
return gulp.watch('./src/**', ['build']);
}