-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
49 lines (42 loc) · 1.4 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
'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var sass = require('gulp-sass');
var gutil = require('gulp-util');
var jstify = require('jstify');
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('./scss/*.scss')
.pipe(sass())
.pipe(gulp.dest('./client/css'));
});
gulp.task('scripts', function () {
// set up the browserify instance on a task basis
var b = browserify({
entries: './scripts/app.js',
debug: true
}).transform('jstify', { engine: 'lodash' });
return b.bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./client/scripts'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('./scripts/*/*.js', ['lint', 'scripts']);
gulp.watch('./scripts/*/*.tpl', ['lint', 'scripts']);
gulp.watch('./scss/*.scss', ['sass']);
});
// Default Task
gulp.task('default', ['sass', 'scripts', 'watch']);