-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
85 lines (74 loc) · 2.05 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
74
75
76
77
78
79
80
81
82
83
84
85
'use strict';
const
{src, dest, watch, series} = require('gulp'),
sass = require('gulp-sass'),
cleancss = require('gulp-clean-css'),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
uglify = require('gulp-uglify'),
babel = require('gulp-babel'),
bump = require('gulp-bump'),
semver = require('semver'),
info = require('./package.json'),
wpPot = require('gulp-wp-pot'),
touch = require('gulp-touch-cmd')
;
function css() {
return src('./assets/css/rrze-elements.scss', {
sourcemaps: false
})
.pipe(sass())
.pipe(postcss([autoprefixer()]))
.pipe(cleancss())
.pipe(dest('./assets/css/'))
.pipe(touch());
}
function cssdev() {
return src('./assets/css/*.scss', {
sourcemaps: true
})
.pipe(sass())
.pipe(postcss([autoprefixer()]))
.pipe(dest('./assets/css/'))
.pipe(touch());
}
function patchPackageVersion() {
var newVer = semver.inc(info.version, 'patch');
return src(['./package.json', './' + info.main])
.pipe(bump({
version: newVer
}))
.pipe(dest('./'))
.pipe(touch());
};
function prereleasePackageVersion() {
var newVer = semver.inc(info.version, 'prerelease');
return src(['./package.json', './' + info.main])
.pipe(bump({
version: newVer
}))
.pipe(dest('./'))
.pipe(touch());;
};
function updatepot() {
return src("**/*.php")
.pipe(
wpPot({
domain: info.textdomain,
package: info.name,
team: info.author.name,
bugReport: info.repository.issues,
ignoreTemplateNameHeader: true
})
)
.pipe(dest(`languages/${info.textdomain}.pot`))
.pipe(touch());
};
function startWatch() {
watch('./assets/css/*.scss', css);
}
exports.css = css;
exports.dev = series(cssdev, prereleasePackageVersion);
exports.build = series(css, patchPackageVersion);
exports.pot = updatepot;
exports.default = startWatch;