forked from shiroari/click2call
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (60 loc) · 1.52 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
'use strict';
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var jasmine = require('gulp-jasmine');
var del = require('del');
var dest;
var destForBuild = 'dist/assets';
var destForDemo = 'demo/assets';
// Build environment
gulp.task('init-build', function () {
dest = destForBuild;
});
// Demo environment
gulp.task('init-demo', function () {
dest = destForDemo;
});
// Scripts
gulp.task('scripts', function () {
return gulp.src('src/scripts/*.js')
.pipe(gulp.dest(dest + '/js'));
});
// Libs
gulp.task('copy-libs', function () {
return gulp.src('src/libs/*.js')
.pipe(gulp.dest(dest + '/js'));
});
gulp.task('copy-libs-and-minify', function () {
return gulp.src('src/libs/*.js')
.pipe(rename(function (path) {
path.basename += '.min';
}))
.pipe(uglify())
.pipe(gulp.dest(dest + '/js'));
});
// Styles
gulp.task('styles', function () {
return gulp.src('src/styles/*.css')
.pipe(gulp.dest(dest + '/css'));
});
// HTML
gulp.task('html', function () {
return gulp.src('src/html/*.html')
.pipe(gulp.dest('demo'));
});
// Clean
gulp.task('clean', function () {
del(['dist/*', 'demo/*']);
});
// Tests
gulp.task('test', function () {
return gulp.src('tests/utils.js')
.pipe(jasmine());
});
// Build
gulp.task('build', ['init-build', 'test', 'scripts', 'copy-libs-and-minify']);
// Demo
gulp.task('demo', ['init-demo', 'test', 'scripts', 'copy-libs', 'styles', 'html']);
// Default task
gulp.task('default', ['clean', 'build']);