-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (41 loc) · 1.49 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
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-ruby-sass');
var plumber = require('gulp-plumber');
var webserver = require('gulp-webserver');
var symlink = require('gulp-symlink');
var browserify = require('gulp-browserify');
function sassErrorHandler(err) {
gutil.beep();
gutil.log(gutil.colors.black.bgRed(err.message));
}
gulp.task('html', function() {
return gulp.src('./src/index.html')
.pipe(gulp.dest('./dist'));
});
gulp.task('scss', function() {
return gulp.src('./src/scss/default.scss')
.pipe(plumber({ errorHandler: sassErrorHandler }))
.pipe(sass({ sourcemap: true, sourcemapPath: './scss' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('js', function() {
return gulp.src('./src/js/default.js', { read: false })
.pipe(browserify({ debug: true }))
.pipe(gulp.dest('./dist'));
});
gulp.task('server', function() {
return gulp.src('./dist')
.pipe(webserver({ livereload: true, https: true }));
});
gulp.task('watch', function() {
gulp.watch('./src/index.html', ['html']);
gulp.watch('./src/scss/**/*.scss', ['scss']);
gulp.watch('./src/js/**/*.js', ['js']);
});
gulp.task('symlink', function() {
return gulp.src(['./src/images/', './src/scss/', './src/fonts/', './src/js/vendor/modernizr.js'])
.pipe(symlink(['./dist/images', './dist/scss', './dist/fonts', './dist/modernizr.js']));
});
gulp.task('default', ['html', 'js', 'scss', 'server', 'watch']);
gulp.task('setup', ['symlink']);