-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
37 lines (32 loc) · 911 Bytes
/
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
var gulp = require('gulp');
var less = require('gulp-less');
var cssmin = require('gulp-cssmin');
var replace = require('gulp-replace');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
gulp.task('less', function () {
return gulp.src('./less/**/[^_]*.less')
.pipe(less())
.pipe(postcss([
autoprefixer({
cascade: false
})
]))
.pipe(cssmin())
.pipe(gulp.dest('./public/css'));
});
gulp.task('css-cache-bust', function () {
var bust = (new Date().getTime()).toString(16);
return gulp
.src(['public/_shared/layout.jade'])
.pipe(
replace(/bust=[0-9a-f]+/gi, function () {
return 'bust=' + bust;
})
)
.pipe(gulp.dest('public/_shared/'));
});
gulp.task('watch', function () {
gulp.watch('./less/**/*.less', gulp.series('less', 'css-cache-bust'));
});
gulp.task('default', gulp.series('watch'));