-
Notifications
You must be signed in to change notification settings - Fork 31
/
gulpfile.js
57 lines (50 loc) · 1.68 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
var gulp = require('gulp');
var path = require('path');
var less = require('gulp-less');
var concat = require('gulp-concat');
var watch = require('gulp-watch');
var batch = require('gulp-batch');
var plumber = require('gulp-plumber');
var header = require('gulp-header');
var footer = require('gulp-footer');
var root = './application';
gulp.task('public-css', function () {
return gulp
.src([path.join(root, 'static/**/*.less'),
'!' + path.join(root, 'static/bower_components/**/*.less')])
.pipe(plumber())
.pipe(less({
paths: [path.join(root, 'static/css')]
}))
.pipe(gulp.dest(path.join(root, 'static')));
});
gulp.task('macros-css', function () {
return gulp
.src(path.join(root, 'macros/**/_*.less'))
.pipe(plumber())
.pipe(less({
paths: [path.join(root, 'static/css')]
}))
.pipe(concat('macros.css'))
.pipe(gulp.dest(path.join(root, 'static/output/')));
});
gulp.task('macros-js', function () {
return gulp
.src(path.join(root, 'macros/**/_*.js'))
.pipe(plumber())
.pipe(header('(function () {'))
.pipe(footer('})();'))
.pipe(concat('macros.js'))
.pipe(gulp.dest(path.join(root, 'static/output/')));
});
gulp.task('build', ['macros-css', 'macros-js', 'public-css'], function () {
});
gulp.task('watch', ['build'], function () {
watch(path.join(root, 'macros/**/_*.js'), batch(function (events, done) {
gulp.start('macros-js', done);
}));
watch(path.join(root, 'macros/**/_*.less'), batch(function (events, done) {
gulp.start('macros-css', done);
}));
});
gulp.task('default', ['build']);