-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
48 lines (42 loc) · 1.36 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
// Include gulp
var gulp = require('gulp');
// Include Our Plugins
var jshint = require('gulp-jshint'),
sass = require('gulp-sass'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
changed = require('gulp-changed'),
autoprefixer = require('gulp-autoprefixer');
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('assets/scss/*.scss')
.pipe(sass({ outputStyle: 'compressed' }))
.pipe(autoprefixer({
browsers: ['last 2 versions', 'ie >= 9', 'and_chr >= 2.3'],
cascade: false
}))
.pipe(rename('style.min.css'))
.pipe(gulp.dest('assets/css'));
});
// Lint Task
gulp.task('lint', function() {
return gulp.src('assets/js/scripts/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('assets/js/scripts/*.js')
.pipe(concat('all.js'))
.pipe(rename('all.min.js'))
.pipe(uglify())
.pipe(gulp.dest('assets/js'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('assets/js/scripts/*.js', ['lint', 'scripts']);
gulp.watch('assets/scss/**', ['sass']);
});
// Default Task
gulp.task('default', ['lint', 'sass', 'scripts', 'watch']);