-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
47 lines (39 loc) · 1.22 KB
/
gulpfile.js
File metadata and controls
47 lines (39 loc) · 1.22 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
// Load all the modules from package.json
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
watch = require('gulp-watch'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
wait = require('gulp-wait')
concat = require('gulp-concat');
// Default error handler
var onError = function (err) {
console.log('An error occured:', err.message);
this.emit('end');
}
// This task creates two files, the regular and
// the minified one.
gulp.task('scss', function () {
return gulp.src('stylesheets/main.scss')
.pipe(plumber({ errorHandler: onError }))
.pipe(wait(1500))
.pipe(sass())
.pipe(gulp.dest('./css'))
.pipe(minifycss())
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist/css'));
});
gulp.task('scripts', function () {
// return gulp.src('./js/*.js')
return gulp.src(['./js/MapManager.js', './js/main.js'])
.pipe(concat('all.js'))
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('watch', function () {
gulp.watch(['./js/**/*.js'], ['scripts'])
gulp.watch('./stylesheets/**/*.scss', ['scss']);
});
gulp.task('default', ['watch'], function () {
// Does nothing in this task, just triggers the dependent 'watch'
});