gulpfile.js
2.04 KB
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
58
59
60
61
62
63
64
65
66
var gulp = require('gulp');
var less = require('gulp-less');
var minifyCss = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var path = require('path');
var temas = ['themes/blog-tema', 'themes/dadospessoais-tema', 'themes/debatepublico-tema', 'themes/marcocivil-tema',
'themes/pensandoodireito-tema', 'plugins/wp-side-comments/includes'];
var plumberHandler = function (err) {
console.log(err);
this.emit('end');
};
temas.forEach(function (item) {
gulp.task(item, function () {
return gulp.src('src/wp-content/' + item + '/css/less/*.less')
.pipe(plumber({
errorHandler: plumberHandler
}))
.pipe(less())
.pipe(sourcemaps.init())
.pipe(minifyCss())
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/wp-content/' + item + '/css'));
});
});
gulp.task('default', temas, function () {
gulp.src('src/wp-content/themes/participacao-tema/css/less/site-global.less')
.pipe(plumber({
errorHandler: plumberHandler
}))
.pipe(less({
paths: ['src/wp-content/themes/participacao-tema/css/less']
}))
.pipe(sourcemaps.init())
.pipe(minifyCss())
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/wp-content/themes/participacao-tema/css'));
gulp.src('src/wp-content/themes/participacao-tema/css/less/theme/theme-participacao.less')
.pipe(plumber({
errorHandler: plumberHandler
}))
.pipe(less({
paths: [
'src/wp-content/themes/participacao-tema/css/less',
]
}))
.pipe(sourcemaps.init())
.pipe(minifyCss())
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/wp-content/themes/participacao-tema/css'));
});
gulp.task('watch', function () {
temas.forEach(function (item) {
gulp.watch('src/wp-content/themes/' + item + '-tema/css/less/*.less', [item]);
});
});