-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
68 lines (61 loc) · 1.79 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');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var notify = require('gulp-notify');
var plumber = require('gulp-plumber');
var stripDebug = require('gulp-strip-debug');
gulp.task('sass', function() {
gulp.src('./app/sass/**/*.+(scss|sass)')
.pipe(plumber({
errorHandler: notify.onError('Error: <%= error.message %>')
}))
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./app/css'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('scripts', function() {
gulp.src([
'./bower_components/jquery/dist/jquery.min.js',
'./bower_components/bootstrap-sass/assets/javascripts/bootstrap.min.js',
'./bower_components/circles/circles.min.js',
'./app/js/jquery.placeholder.min.js'
])
.pipe(plumber({
errorHandler: notify.onError('Error: <%= error.message %>')
}))
.pipe(uglify())
.pipe(concat('libs.js'))
.pipe(stripDebug())
.pipe(gulp.dest('./app/js'));
});
gulp.task('jshint', function() {
gulp.src('app/js/*Controller.js')
.pipe(plumber({
errorHandler: notify.onError('Error: <%= error.message %>')
}))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('browserSync', function() {
browserSync({
server: {
baseDir: 'app'
}
});
});
gulp.task('watch', ['scripts', 'browserSync', 'sass'], function() {
gulp.watch('app/js/*Controller.js', ['jshint', 'scripts'], browserSync.reload);
gulp.watch('app/sass/**/*.+(scss|sass)', ['sass'], browserSync.reload);
gulp.watch('app/*.html', browserSync.reload);
});