-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (30 loc) · 996 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 fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var less = require('gulp-less');
var concat = require('gulp-concat');
var minifyCss = require('gulp-minify-css');
var chug = require('gulp-chug');
var BOOKMARKLETS_PATH = './bookmarklets';
function getFolders (dir) {
return fs.readdirSync(dir)
.filter(function (file) {
return fs.statSync(path.join(dir, file)).isDirectory();
});
}
gulp.task('less', function () {
var folders = getFolders(BOOKMARKLETS_PATH);
for (var i in folders) {
var projectPath = BOOKMARKLETS_PATH + '/' + folders[i];
gulp.src(projectPath + '/less/**/*.less')
.pipe(less())
.pipe(concat('main.css'))
.pipe(minifyCss())
.pipe(gulp.dest(projectPath + '/'));
}
});
gulp.task('bookmarklets', function () {
gulp.src(BOOKMARKLETS_PATH + '/**/gulpfile.js')
.pipe(chug());
});
gulp.task('default', ['less', 'bookmarklets']);