-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
42 lines (35 loc) · 1.31 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
var path = require('path');
var gulp = require('gulp');
var gutil = require('gulp-util');
var watch = require('gulp-watch');
var less = require('gulp-less');
var minifyCSS = require('gulp-minify-css');
var on_error = function (err) { console.error(err.message); };
var generate_theme_less = function(dir, file_name, less_options) {
if (typeof less_options === 'undefined') {
less_options = {};
}
return gulp.src(dir + '/' + file_name + '.less').
pipe(less(less_options).on('error', on_error)).
pipe(minifyCSS().on('error', on_error)).
pipe(gulp.dest(dir));
};
gulp.task('coral-bubbles-css', function() {
var less_options = {paths: ['coral-bubbles/bootstrap']};
return generate_theme_less('coral-bubbles', 'theme', less_options);
});
gulp.task('tulip-world-css', function() {
return generate_theme_less('tulip-world', 'theme');
});
gulp.task('sherbet-punch-css', function() {
var less_options = {paths: ['sherbet-punch/bower_components']};
return generate_theme_less('sherbet-punch', 'theme', less_options);
});
gulp.task('watch', function() {
var themes = ['tulip-world', 'coral-bubbles', 'sherbet-punch'];
for (var i=0; i<themes.length; i++) {
var theme = themes[i];
gulp.watch([theme + '/*.less'], [theme + '-css']);
}
});
gulp.task('default', ['watch']);