forked from Freemius/wordpress-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
executable file
·41 lines (34 loc) · 1.23 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
require('dotenv').config();
const {parallel, watch} = require('gulp');
const livereload = require('gulp-livereload');
const {createTranslation, createPot} = require('./gulptasks/translate');
const {getSdkScssCompiler, scssSources} = require('./gulptasks/sass');
const {getSdkJSCompilers, jsSources} = require('./gulptasks/scripts');
const DEFAULT_GULP_WATCH_OPTIONS = {ignoreInitial: false, usePolling: true};
/**
* Tasks related to translations of the SDK.
* This will
* 1. Create `languages/freemius.pot` file.
* 2. Upload it to Transifex.
* 3. Download latest translations from Transifex.
* 4. Build `languages/freemius-xx_XX.po` and `languages/freemius-xx_XX.mo` files.
*/
exports.translate = createTranslation;
/**
* Create `languages/freemius.pot` file. Used mainly by the CI to make sure POT can be created.
*/
exports.pot = createPot;
/**
* The build task. This will build
* 1. SASS files.
* 2. JS files.
*/
exports.build = parallel(
getSdkScssCompiler(true),
...getSdkJSCompilers(true)
);
exports.dev = function () {
livereload.listen();
watch(scssSources, DEFAULT_GULP_WATCH_OPTIONS, getSdkScssCompiler(false));
watch(Object.values(jsSources), DEFAULT_GULP_WATCH_OPTIONS, parallel(...getSdkJSCompilers(false)));
}