forked from mercadopago/cart-woocommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (43 loc) · 1.39 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
const gulp = require('gulp');
const git = require('gulp-git');
const uglify = require('gulp-uglify');
const rename = require('gulp-rename');
const jshint = require('gulp-jshint');
const jshintStylish = require('jshint-stylish');
const wpPot = require('gulp-wp-pot');
const config = {
scripts: [
'./assets/js/basic_config_mercadopago.js',
'./assets/js/basic-cho.js',
'./assets/js/credit-card.js',
'./assets/js/custom_config_mercadopago.js',
'./assets/js/ticket_config_mercadopago.js',
'./assets/js/ticket.js',
],
};
gulp.task('jshint', function() {
return gulp.src(config.scripts)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(jshintStylish))
.pipe(jshint.reporter('fail'));
});
gulp.task('scripts', function() {
return gulp.src(config.scripts)
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('./assets/js/'));
});
gulp.task('wpPot', function () {
return gulp.src('**/*.php')
.pipe(wpPot( {
domain: 'woocommerce-mercadopago',
lastTranslator: 'MPB Desenvolvimento <[email protected]>',
} ))
.pipe(gulp.dest('./i18n/languages/woocommerce-mercadopago.pot'));
});
gulp.task('git-add', function() {
return gulp.src('.')
.pipe(git.add());
});
gulp.task('pre-commit', gulp.series('jshint', 'scripts', 'wpPot', 'git-add'));
gulp.task('default', gulp.series('scripts'));