-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
73 lines (66 loc) · 2.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
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
67
68
69
70
71
72
73
const autoprefixer = require('gulp-autoprefixer');
const cleanCSS = require('gulp-clean-css');
const gulp = require('gulp');
const mergeMediaQueries = require('gulp-merge-media-queries');
const notify = require('gulp-notify');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
const sort = require('gulp-sort');
const wp_pot = require('gulp-wp-pot');
// Define the source paths for each file type.
const src = {
php: ['**/*.php', '!node_modules/**'],
sass: ['assets/css/src/**/*']
};
// Define the destination paths for each file type.
const dest = {
sass: 'assets/css',
translate: 'languages'
};
// Take care of SASS.
gulp.task('sass', function (done) {
return gulp.src(src.sass)
.pipe(sass({
outputStyle: 'expanded'
}).on('error', sass.logError))
.pipe(mergeMediaQueries())
.pipe(autoprefixer({
cascade: false
}))
.pipe(cleanCSS({
compatibility: 'ie8'
}))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(dest.sass))
.pipe(notify('wA11y SASS compiled'))
.on('end', done);
});
// Create the .pot translation file.
gulp.task('translate', function (done) {
return gulp.src(src.php)
.pipe(sort())
.pipe(wp_pot({
domain: 'wa11y',
destFile: 'wa11y.pot',
package: 'wA11y',
bugReport: 'https://github.com/bamadesigner/wa11y/issues',
lastTranslator: 'Rachel Cherry',
team: 'Rachel Cherry',
headers: false
}))
.pipe(gulp.dest(dest.translate))
.pipe(notify('wA11y translated'))
.on('end', done);
});
// Compile all the things.
gulp.task('compile', gulp.series('sass'));
// Let's get this party started.
gulp.task('default', gulp.series('compile', 'translate'));
// I've got my eyes on you(r file changes).
gulp.task('watch', gulp.series('default', function (done) {
gulp.watch(src.sass, gulp.series('sass'));
gulp.watch(src.php, gulp.series('translate'));
return done();
}));