-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
64 lines (55 loc) · 1.65 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
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var smushit = require('gulp-smushit');
var concat = require('gulp-concat');
var merge = require('merge-stream');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
gulp.task('default', ['browser-sync'], function() {
gulp.watch("scss/**/*.scss", ['sass']);
gulp.watch('js/src/**/*.js', ['lint', 'minify']);
});
gulp.task('sass', function() {
return gulp.src('scss/main.scss')
.pipe(sass())
.on('error', function(err) {
console.log(err.message);
})
.pipe(gulp.dest('css'))
.pipe(reload({stream:true}));
});
gulp.task('smush', function() {
return gulp.src('images/*.{jpg,png}').pipe(smushit({
'verbose': true
})).pipe(gulp.dest('images'));
});
gulp.task('minify', function() {
var together = gulp.src([
'js/src/vendor/jquery-1.11.1.min.js',
'js/src/vendor/jquery.validate.js',
'js/src/**/*.js',
'!js/src/vendor/modernizr-2.6.2.min.js'
])
.pipe(concat('all.js'))
.pipe(gulp.dest('js/dist'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('js/dist'));
var separate = gulp.src('js/src/vendor/modernizr-2.6.2.min.js')
.pipe(gulp.dest('js/dist/vendor'));
return merge(together, separate, reload());
});
gulp.task('lint', function() {
return gulp.src(['js/src/**/*.js', '!js/src/vendor/*.js'])
// lint all js files but what's in the vendor dir
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('browser-sync', function() {
browserSync({
proxy: "gulp_project_2.dev/"
});
});