forked from psydernet/woocommerce-gateway-xem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
87 lines (70 loc) · 1.94 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
86
var gulp = require('gulp');
var browserSync = require('browser-sync');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var wpPot = require('gulp-wp-pot');
var sort = require('gulp-sort');
var del = require('del');
var zip = require('gulp-zip');
// Static Server + watching scss/html files
gulp.task('serve', ['sass', 'js'], function() {
browserSync.init({
files: "assets/css/*.css",
proxy: "rpe.eu.ngrok.io",
logLevel: "info"
});
gulp.watch( "assets/scss/**/*.scss" , ['sass']);
gulp.watch( "assets/js/plugin.js", ['js'] );
});
//sass
gulp.task('sass', function() {
return gulp.src(['assets/css/xem-checkout.scss'])
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest("assets/css/"));
});
//js frontend
gulp.task('js', function(){
return gulp.src(['assets/js/xem-checkout.js'])
.pipe(sourcemaps.init())
.pipe(concat('xem-checkout.min.js'))
.pipe(gulp.dest('assets/js/'))
.pipe(uglify())
.pipe(sourcemaps.write('maps/'))
.pipe(gulp.dest('assets/js/'));
});
gulp.task('clean', function () {
return del([
'dist/trunk/**/*',
'dist/tags/InsertReleaseVersionHere/**/*',
],({force: true}));
});
gulp.task('zip', ['copy'], function () {
return gulp.src('dist/**')
.pipe(zip('woocommerce-gateway-xem.zip'))
.pipe(gulp.dest(''));
});
gulp.task('copy',['clean','sass', 'js'], function () {
return gulp.src([
'./**',
'!node_modules/**',
'!node_modules',
'!.gitignore',
'!composer.**',
'!gulpfile.js',
'!dist',
'!dist/**',
'!package.json',
'!**.zip'
])
.pipe(gulp.dest('dist/trunk/'))
.pipe(gulp.dest('dist/tags/InsertReleaseVersionHere'));
});
gulp.task('default', ['serve']);
gulp.task('deploy', ['zip']);