-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
67 lines (56 loc) · 1.59 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';
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var jshint = require('gulp-jshint');
var lazypipe = require('lazypipe');
var source = require('vinyl-source-stream');
var sass = require('gulp-sass');
var notify = require("gulp-notify");
// Utils
// =======================================
function handleErrors(){
var args = Array.prototype.slice.call(arguments);
// Send error to notification center with gulp-notify
notify.onError({
title: "Compile Error",
message: "<%= error.message %>"
}).apply(this, args);
// Keep gulp from hanging on this task
this.emit('end');
}
// Tasks
// =======================================
gulp.task('browserify', function() {
return browserify('./app/javascripts/main.js')
.bundle()
.on('error', handleErrors)
.pipe(source('app.js'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('jshint', function() {
return gulp.src([
'./app/javascripts/main.js',
'./app/javascripts/**/*.js'
])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'));
});
gulp.task('sass', function () {
return gulp.src('./app/scss/*.scss')
.pipe(sass({
compass: true,
bundleExec: true,
sourcemap: true,
sourcemapPath: '../scss'
}))
.on('error', handleErrors)
.pipe(gulp.dest('./dist/'));
});
gulp.task('htdocs', function() {
return gulp.src('app/htdocs/**')
.on('error', handleErrors)
.pipe(gulp.dest('./dist/'));
});
gulp.task('build', ['jshint', 'htdocs', 'sass', 'browserify']);
gulp.task('default', ['build']);