-
Notifications
You must be signed in to change notification settings - Fork 70
/
Gulpfile.js
executable file
·67 lines (56 loc) · 1.26 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
'use strict';
/**
* Dependencies
*/
var gulp = require('gulp');
var sass = require('gulp-sass');
var wrapUMD = require('gulp-wrap-umd');
var sourcemaps = require('gulp-sourcemaps');
/**
* Directories
*/
var src = {
sass: 'src/assets/sass',
css: 'src/assets/css',
js: 'src/app/'
};
/**
* Callbacks
*/
function watcherCallback(changedFile) {
console.log('\n Change saved...', changedFile.path, '\n');
}
function sassCompileCallback(arg) {
console.log('\n SASS compilation complete. \n');
}
function handleError(err) {
console.log('\n SASS Error: \n', err.toString());
this.emit('end');
}
/**
* Tasks
*/
gulp.task('sass', function () {
return gulp.src(src.sass + '/main.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write())
.pipe(gulp.dest(src.css))
.on('error', handleError)
.on('end', sassCompileCallback)
;
});
gulp.task('watch', function () {
return gulp.watch(src.sass + '/**/*.scss', ['sass'])
.on('change', watcherCallback)
.on('error', handleError)
;
});
gulp.task('umd', function () {
gulp.src([src.js + 'vendor/THREEOrbitControls/index.js'])
.pipe(wrapUMD({
namespace: 'THREE.OrbitControls'
}))
.pipe(gulp.dest(src.js + 'vendor/THREEOrbitControls/umd'))
;
});