-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGulpfile.js
More file actions
96 lines (78 loc) · 2.44 KB
/
Gulpfile.js
File metadata and controls
96 lines (78 loc) · 2.44 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
'use strict';
var gulp = require('gulp');
var browserSync = require('browser-sync');
var bower = require('bower');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var gutil = require('gulp-util');
var nodemon = require('gulp-nodemon');
var reload = browserSync.reload;
var shell = require('gulp-shell');
var sh = require('shelljs');
var when = require('gulp-if');
var angularFilesort = require('gulp-angular-filesort');
var inject = require('gulp-inject');
// the paths to our app files
var paths = {
// all our client app js files, not including 3rd party js files
scripts: ['client/app/**/*.js'],
html: ['client/app/**/*.html', 'client/index.html'],
styles: ['client/styles/style.css'],
server: ['server/**/*.js'],
test: ['specs/**/*.js'],
sass: ['client/scss/**/*.scss']
};
// Inject ionic(angular) app into index.html
gulp.task('index', function () {
var sources = gulp.src(['./client/www/js/**/*.js']).pipe(angularFilesort());
gulp.src('./client/www/index.html')
.pipe(inject(sources, {ignorePath: 'client/www', addRootSlash: false }))
.pipe(gulp.dest('./client/www'));
});
// Compile sass
gulp.task('sass', function(done) {
return gulp.src('./client/scss/ionic.app.scss')
.pipe(sass())
.pipe(gulp.dest('./client/www/css/'))
.pipe(sass({sourcemap: true}))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./client/www/css/'))
.pipe(reload({stream:true}));
});
// any changes made to your
// client side code will automagically refresh your page
// with the new changes
gulp.task('browser-sync', ['serve'],function () {
browserSync({
notify: true,
server : {
basedir : './'
},
injectChanges: true,
files: paths.scripts.concat(paths.html, paths.styles),
proxy: 'localhost:5000'
});
});
gulp.task('karma', shell.task([
'karma start'
]));
gulp.task('watch', function () {
gulp.watch("./client/scss/*.scss", ['sass'])
gulp.watch("./client/templates/*.html", ['bs-reload', 'index']);
gulp.watch("./client/js/*.js", ['bs-reload', 'index']);
});
// start our node server using foreman
gulp.task('serve', shell.task([
'foreman run local'
]));
gulp.task('install', shell.task([
'npm install',
'bower install'
]));
gulp.task('default', ['sass', 'index', 'browser-sync', 'watch']);
gulp.task('deploy', ['sass', 'index']);