-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
38 lines (34 loc) · 1.06 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
// Less configuration
var gulp = require('gulp');
var less = require('gulp-less');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
gulp.task('less', function() {
// All .less files; excluding node_modules folder and partials
var targets = ['!node_modules/**/*.*', '**/[^_]*.less'];
// Generate css
gulp.src(targets)
.pipe(less().on('error', function(error) {
console.error(error)
}))
.pipe(gulp.dest(function(f) {
console.log("Generated " + f.path);
return f.base;
}));
// Generate min.css
gulp.src(targets)
.pipe(less().on('error', function(error) {
console.error(error)
}))
.pipe(cssmin().on('error', function(error) {
console.error(error);
}))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest(function(f) {
console.log("Generated " + f.path);
return f.base;
}));
});
gulp.task('default', ['less'], function() {
gulp.watch('**/*.less', ['less']);
});