-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathgulpfile.js
More file actions
51 lines (46 loc) · 1.72 KB
/
gulpfile.js
File metadata and controls
51 lines (46 loc) · 1.72 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
var gulp = require('gulp');
var del = require('del');
var exec = require('child_process').exec;
var config = require('./scripts/config.json');
var gulpWatch = require('gulp-watch');
var argv = process.argv;
/**
* Ionic Gulp tasks, for more information on each see
* https://github.com/driftyco/ionic-gulp-tasks
*/
var buildBrowserify = require('ionic-gulp-browserify-typescript');
var buildSass = require('ionic-gulp-sass-build');
var copyHTML = require('ionic-gulp-html-copy');
var copyFonts = require('ionic-gulp-fonts-copy');
var copyScripts = require('ionic-gulp-scripts-copy');
gulp.task('watch', ['sass', 'html', 'fonts'], function(done) {
gulpWatch('app/**/*.scss', function() { gulp.start('sass'); });
gulpWatch('app/**/*.html', function() { gulp.start('html'); });
buildBrowserify({ watch: true }).on('end', done);
});
gulp.task('build', ['sass', 'html', 'fonts'], buildBrowserify);
gulp.task('sass', buildSass);
gulp.task('html', copyHTML);
gulp.task('fonts', copyFonts);
gulp.task('scripts', copyScripts);
gulp.task('clean', function(done) {
del('www/build', done);
});
/**
* Ionic hooks
* Add ':before' or ':after' to any Ionic project command name to run the specified
* tasks before or after the command.
*/
gulp.task('serve:before', ['watch']);
gulp.task('emulate:before', ['build']);
gulp.task('deploy:before', ['build']);
// we want to 'watch' when livereloading
var shouldWatch = argv.indexOf('-l') > -1 || argv.indexOf('--livereload') > -1;
gulp.task('run:before', [shouldWatch ? 'watch' : 'build']);
/* FOR IONIC SITE DEBUGGING ONLY */
gulp.task('site-watch', ['site-copy'], function() {
gulp.watch('app/**/*', ['site-copy']);
});
gulp.task('site-copy', ['build'], function() {
exec('cp -R www ' + config.demoDest);
});