-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (63 loc) · 1.97 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
69
70
71
// Include gulp
var gulp = require('gulp');
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
bourbon = require('node-bourbon'),
bs = require('browser-sync').create(),
notify = require('gulp-notify'),
sourcemaps = require('gulp-sourcemaps'),
jshint = require('gulp-jshint');
// uglify = require('gulp-uglify'),
// rename = require('gulp-rename'),
// clean = require('gulp-clean'),
// concat = require('gulp-concat'),
gulp.task('browser-sync', function() {
bs.init({
server: {
baseDir: "./"
}
});
});
// Lint Task
gulp.task('lint', function() {
return gulp.src('js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
// Compile Our Sass
gulp.task('sass', function() {
return gulp.src('styles/scss/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
errLogToConsole: true,
outputStyle: 'compressed',
includePaths: bourbon.includePaths,
quiet: true
}).on('error', sass.logError))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('styles/css'))
.pipe(bs.stream())
.pipe(notify({ message: 'Compiled sass' }));
});
// Concatenate & Minify JS
//gulp.task('scripts', function() {
// return gulp.src('js/*.js')
// .pipe(concat('site-all.js'))
// .pipe(gulp.dest('js'))
// .pipe(rename({suffix: '.min'}))
// .pipe(uglify())
// .pipe(gulp.dest('js/dist'))
// .pipe(gulp.dest('_site/js/dist'))
// .pipe(browserSync.stream())
// .pipe(notify({ message: 'Scripts complete' }));
//});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('js/*.js', ['lint']);
gulp.watch('styles/scss/*.scss', ['sass']);
gulp.watch('*.html').on('change', bs.reload);
});
// Default Task
gulp.task('default', ['browser-sync', 'lint', 'sass', 'watch']);