-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
68 lines (60 loc) · 1.75 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
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
eventStream = require('event-stream');
// Sass
gulp.task('sass', function () {
return gulp.src(['./src/scss/**/*.scss'])
.pipe($.plumber({
errorHandler: $.notify.onError('<%= error.message %>')
}))
.pipe($.sourcemaps.init())
.pipe($.sass({
errLogToConsole: true,
outputStyle : 'compressed',
sourceComments : 'normal',
sourcemap : true
}))
.pipe($.sourcemaps.write('./map'))
.pipe(gulp.dest('./assets/css'));
});
// JS Hint
gulp.task('jshint', function () {
return gulp.src(['./src/js/**/*.js'])
.pipe($.plumber({
errorHandler: $.notify.onError('<%= error.message %>')
}))
.pipe($.jshint('./src/js/.jshintrc'))
.pipe($.jshint.reporter('jshint-stylish'));
});
gulp.task('jsBundle', function(){
return gulp.src('./src/js/*.js')
.pipe($.plumber({
errorHandler: $.notify.onError('<%= error.message %>')
}))
.pipe($.sourcemaps.init())
.pipe($.include({
extensions: "js"
}))
.pipe($.uglify())
.pipe($.sourcemaps.write('./map'))
.pipe(gulp.dest('./assets/js/'));
});
// Copy
gulp.task('copy', function () {
return eventStream.merge(
gulp.src([
'./node_modules/angular/angular.min.js',
'./node_modules/angular/angular.min.js.map'
]).pipe(gulp.dest('./assets/js')),
gulp.src('./node_modules/angular-ui-sortable/dist/sortable.min.js').pipe(gulp.dest('./assets/js'))
);
});
// Build
gulp.task('build', ['sass', 'copy', 'jsBundle']);
// watch
gulp.task('watch', function () {
// Make SASS
gulp.watch('./src/scss/**/*.scss', ['sass']);
// Check JS syntax and bundle them
gulp.watch('./src/js/**/*.js', ['jshint', 'jsBundle']);
});