-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (62 loc) · 1.57 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
const gulp = require('gulp')
const nodemon = require('gulp-nodemon')
const concat = require('gulp-concat')
const sass = require('gulp-sass')
const babel = require('gulp-babel');
// PATH VAR
const PUBLIC = './public/'
const COMPRESSED = PUBLIC + 'compressed/'
const DIRECTORIES = {
sass: PUBLIC + 'sass/',
js: PUBLIC + 'js/'
}
const SRC = {
js: [
'./node_modules/three/build/three.js',
'./node_modules/howler/src/howler.core.js',
DIRECTORIES.js + 'functions.js',
DIRECTORIES.js + 'vendors/*.js',
DIRECTORIES.js + 'services/*.js',
DIRECTORIES.js + 'socket/*.js',
DIRECTORIES.js + 'three/*.js',
DIRECTORIES.js + 'controllers/*.js',
DIRECTORIES.js + 'main.js'
],
sass: [
DIRECTORIES.sass + 'main.scss'
]
}
// TASKS
gulp.task('sass', function(){
return gulp.src(SRC.sass)
.pipe(sass({outputStyle: 'compressed'}))
.pipe(concat('/main.css'))
.pipe(gulp.dest(COMPRESSED));
})
gulp.task('js',function() {
return gulp.src(SRC.js)
// .pipe(babel())
.pipe(concat('/main.js'))
.pipe(gulp.dest(COMPRESSED))
})
gulp.task('build', ['sass','js'])
// MONITORING
gulp.task('default', ['watch','nodemon'] ,function(next){
next()
})
gulp.task('nodemon', function(next) {
var called = false
return nodemon({
script: 'app.js',
env: { 'NODE_ENV': 'developement' }
})
.on('start', function() {
if (!called) next()
called = true;
})
})
gulp.task('watch', function(next) {
gulp.watch(DIRECTORIES.sass + '**/*.scss',['sass'])
gulp.watch(DIRECTORIES.js + '**/*.js',['js'])
next()
})