-
Notifications
You must be signed in to change notification settings - Fork 32
/
gulpfile.js
71 lines (60 loc) · 1.96 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
"use strict";
// Include gulp
var gulp = require('gulp');
// Include plugins
var jshint = require('gulp-jshint');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var mocha = require('gulp-mocha');
var source = require('vinyl-source-stream'); // makes browserify bundle compatible with gulp
var streamify = require('gulp-streamify');
var browserify = require('browserify');
// Lint Tasks
gulp.task('lint-app', function() {
return gulp.src('assets/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('lint-lib', function() {
return gulp.src('assets/js/lib/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('lint-spec', function() {
return gulp.src('assets/js/spec/lib/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('lint', ['lint-app', 'lint-lib', 'lint-spec']);
// Test JS
gulp.task('specs', function () {
return gulp.src('assets/js/spec/lib/*.js')
.pipe(mocha());
});
// Concatenate, Browserify & Minify JS
gulp.task('scripts', function() {
return browserify('./assets/js/app.js').bundle()
.pipe(source('all.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./public/'));
});
// Concatenate CSS
gulp.task('styles', function() {
return gulp.src([
'./assets/css/vendor/reset.css',
'./assets/css/lib/profile.css'
])
.pipe(concat('all.css'))
.pipe(gulp.dest('public'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('assets/css/*.css', ['styles']);
gulp.watch('assets/js/*.js', ['specs', 'lint', 'scripts']);
gulp.watch('assets/js/lib/*.js', ['specs', 'lint', 'scripts']);
gulp.watch('assets/js/spec/lib/*.js', ['specs']);
});
// Default Task
gulp.task('default', ['lint', 'specs', 'scripts', 'styles', 'watch']);