-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
114 lines (86 loc) · 2.25 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-ruby-sass');
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var cleanCss = require('gulp-clean-css');
var wait = require('gulp-wait');
var del = require('del');
var zip = require('gulp-zip');
/**
* =Compile SCSS and move to build
*/
gulp.task('sass', function () {
var admin = sass('src/scss/apd-admin.scss', {style: 'compressed'})
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('../css'));
var frontend = sass('src/scss/apd-frontend.scss', {style: 'compressed'})
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('../css'));
});
/**
* =Concat and minify JS
*/
gulp.task('js', function () {
var apd = [
// 'bower_components/bootstrap-sass/assets/javascripts/bootstrap.js',
'src/js/**/*',
'src/js/!apd-admin.js'
];
gulp.src(apd)
.pipe(concat('apd-frontend.js'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('../js'));
var admin = [
'src/js/apd-admin.js'
];
gulp.src(admin)
.pipe(concat('apd-admin.js'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('../js'));
});
/**
* =Copy images
*/
gulp.task('img', function () {
var img = [
'src/img/**/*'
];
gulp.src(img, {base: 'src/img'})
.pipe(gulp.dest('../img'));
});
/**
* =Copy PHP
*/
gulp.task('php', function () {
var php = [
'src/php/**/*'
];
gulp.src(php, {base: 'src/php'})
.pipe(gulp.dest('..'));
});
/**
* =Watcher
*/
gulp.task('watch', function () {
gulp.watch('src/scss/**/*', ['sass']);
gulp.watch('src/js/**/*', ['js']);
gulp.watch('src/fonts/**/*', ['fonts']);
gulp.watch('src/css/**/*', ['css']);
gulp.watch('src/img/**/*', ['img']);
gulp.watch('src/php/**/*', ['php']);
});
gulp.task('default', ['sass', 'js', 'img', 'php']);
/**
* =Extract
*/
gulp.task('extract', function () {
var files = ['../**/*', '!../.git*', '!../gulp/**/*', '!../gulp'];
// var files = '**/*';
gulp.src(files)
.pipe(zip('affiliate-products-db.zip'))
.pipe(gulp.dest('../..'))
});