forked from gMajr/gMajorMobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
102 lines (88 loc) · 2.78 KB
/
Copy pathgulpfile.js
File metadata and controls
102 lines (88 loc) · 2.78 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('gulp-shell');
var shelljs = require('shelljs');
var nodemon = require('gulp-nodemon')
var paths = {
// all our client app js files, not including 3rd party js files
audio: ['audiolib/src/main.js',
'audiolib/src/instruments/*.js',
'audiolib/src/soundBoard/soundBoard.js',
'audiolib/src/soundBoard/soundBoardHelpers/*.js',
'audiolib/src/soundBoard/grid/grid.js',
'audiolib/src/soundBoard/grid/gridhelpers/*.js',
'audiolib/src/test/*.js'],
sass: ['./scss/**/*.scss'],
dependencies: [ 'www/js/app.js', 'www/js/services/**/*.js', 'www/js/controllers/**/*.js'],
templates: ['www/templates/**/*.html']
};
// compiles css
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
// compiles audio files
gulp.task('audio', function(){
gulp.src(paths.audio)
.pipe(concat('sounds.js'))
.pipe(gulp.dest('www/js/build/'));
});
// compiles angular and other dependencies
gulp.task('dependencies', function(){
gulp.src(paths.dependencies)
.pipe(concat('dependencies.js'))
.pipe(gulp.dest('www/js/build/'));
});
// serves and watches for files changes
gulp.task('serve', function(){
nodemon({
script: 'server.js',
ext: 'js html'
});
})
// servers to ionic
gulp.task('serve-ionic', sh.task([
'ionic serve'
]));
// ios emulation
gulp.task('emulate-ios', sh.task([
'ionic emulate ios'
]));
gulp.task('watch', function() {
gulp.watch(paths.audio, ['audio']);
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.dependencies, ['dependencies']);
});
gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});
gulp.task('git-check', function(done) {
if (!shelljs.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});
gulp.task('compile', ['audio', 'dependencies']);
gulp.task('emulate', ['compile', 'emulate-ios']);
gulp.task('default', ['compile', 'serve', 'watch']);