forked from techx/quill
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
76 lines (65 loc) · 1.91 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
75
76
require('dotenv').load();
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var environment = process.env.NODE_ENV;
var nodemon = require('gulp-nodemon');
function swallowError (error) {
//If you want details of the error in the console
console.log(error.toString());
this.emit('end');
}
gulp.task('default', function(){
console.log('yo. use gulp watch or something');
});
gulp.task('js', function () {
if (environment !== 'dev'){
// Minify for non-development
gulp.src(['app/client/src/**/*.js', 'app/client/views/**/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(ngAnnotate())
.on('error', swallowError)
.pipe(uglify())
.pipe(gulp.dest('app/client/build'));
} else {
gulp.src(['app/client/src/**/*.js', 'app/client/views/**/*.js'])
.pipe(sourcemaps.init())
.pipe(concat('app.js'))
.pipe(ngAnnotate())
.on('error', swallowError)
.pipe(sourcemaps.write())
.pipe(gulp.dest('app/client/build'));
}
});
gulp.task('sass', function () {
gulp.src('app/client/stylesheets/site.scss')
.pipe(sass())
.on('error', sass.logError)
.pipe(minifyCss())
.pipe(gulp.dest('app/client/build'));
});
gulp.task('build', ['js', 'sass'], function(){
// Yup, build the js and sass.
});
gulp.task('watch', ['js', 'sass'], function () {
gulp
.watch('app/client/src/**/*.js', ['js']);
gulp
.watch('app/client/views/**/*.js', ['js']);
gulp
.watch('app/client/stylesheets/**/*.scss', ['sass']);
});
gulp.task('server', ['watch'], function(){
nodemon({
script: 'app.js',
env: { 'NODE_ENV': process.env.NODE_ENV || 'DEV' },
watch: [
'app/server'
]
});
});