-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
79 lines (73 loc) · 1.5 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
72
73
74
75
76
77
78
79
/**
* Gulp Build
*
* This is a gulp build for development and distribution of a custom bootstrap
* theme.
*/
var path = require('path');
var gulp = require('gulp');
var clean = require('gulp-clean');
var connect = require('gulp-connect');
var less = require('gulp-less');
var rename = require('gulp-rename');
var gutil = require('gulp-util');
/**
* Connect
*
* Create a quick dev server for livereload.
*/
gulp.task('connect', function () {
connect.server({
livereload: true
});
});
/**
* Watch
*
* Watch for changes to html and css.
*/
gulp.task('watch', function () {
gulp.watch(['src/**/*.less'], ['less-dev']);
gulp.watch(['**/*.html'], ['html-dev']);
});
/**
* Clean dev build.
*/
gulp.task('clean', function () {
gulp.src('./build')
.pipe(clean());
})
/**
* Develoment Less
*
* Compile less for development.
*/
gulp.task('less-dev', function () {
gulp.src('src/main.less')
.pipe(
less({
paths: [
// Add vendor paths for bootstrap import:
path.join(__dirname, 'vendor')
]
})
// Log errors:
.on('error', gutil.log)
)
.pipe(rename('humble-style.css'))
.pipe(gulp.dest('./build'))
.pipe(connect.reload());
});
/**
* Reload HTML
*/
gulp.task('html-dev', function () {
gulp.src('**/*.html')
.pipe(connect.reload());
});
/**
* Default task.
*
* Start dev server, clean, do a build, and start watcher.
*/
gulp.task('default', ['connect', 'clean', 'less-dev', 'watch']);