-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
74 lines (64 loc) · 1.64 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';
const gulp = require('gulp');
const gutil = require('gulp-util');
const sh = require('shelljs');
const inject = require('gulp-inject');
const jade = require('gulp-jade');
const runSequence = require('run-sequence');
const webserver = require('gulp-webserver');
const paths = {
jade: ['./jade/**/*.jade'],
javascript: [
'./www/**/*.js',
'!./www/js/app.js',
'!./www/js/directives.js'
],
css: [
'./www/**/*.css'
]
};
gulp.task('default', ['build']);
gulp.task('build', done => {
runSequence('jade', 'index', done);
});
gulp.task('index', () => {
return gulp.src('./www/index.html')
.pipe(inject(gulp.src(paths.javascript,
{read: false}), {relative: true}))
.pipe(inject(gulp.src(paths.css,
{read: false}), {relative: true}))
.pipe(gulp.dest('./www'));
});
gulp.task('jade', done => {
gulp.src(paths.jade)
.pipe(jade())
.pipe(gulp.dest('./www'))
.on('end', done);
});
gulp.task('watch', ['serve'], () => {
gulp.watch([
paths.jade,
paths.javascript,
paths.css
], ['build']);
});
gulp.task('serve', ['build'], () => {
gulp.src('www')
.pipe(webserver({
livereload: true
}));
});
gulp.task('install', ['git-check']);
gulp.task('git-check', done => {
if (!sh.which('git')) {
console.log(
` ${gutil.colors.red('Git is not installed.')}
Git, the version control system, is required to download Ionic.
Download git here: ${gutil.colors.cyan('http://git-scm.com/downloads')}.
Once git is installed, run '${gutil.colors.cyan('gulp install')}' again.
`
);
process.exit(1);
}
done();
});