forked from mapsteps/page-builder-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
114 lines (86 loc) · 2.63 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 plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-ruby-sass');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var manifest = require('./assets/manifest.json');
var config = manifest.config;
// Scripts Task
// Minify JS
gulp.task('scripts_min', function(){
gulp.src('assets/js/*.js')
.pipe(plumber())
.pipe(uglify())
.pipe(rename({ suffix: '-min' }))
.pipe(gulp.dest('js/min'))
.pipe(reload({ stream: true }))
});
// Styles Task
// Compile Main Styles
gulp.task('styles', function() {
return sass('assets/scss/style.scss', {
style: 'compressed'
})
.pipe(gulp.dest(''))
.pipe(reload({ stream: true }))
});
// Compile Responsive Styles
gulp.task('responsive_styles_min', function() {
return sass('assets/scss/responsive.scss', {
style: 'compressed'
})
.pipe(rename({ suffix: '-min' }))
.pipe(gulp.dest('css/min'))
.pipe(reload({ stream: true }))
});
// Compile RTL Styles
gulp.task('rtl_styles_min', function() {
return sass('assets/scss/rtl.scss', {
style: 'compressed'
})
.pipe(rename({ suffix: '-min' }))
.pipe(gulp.dest('css/min'))
.pipe(reload({ stream: true }))
});
// Compile EDD Styles
gulp.task('edd_styles_min', function() {
return sass('assets/edd/scss/edd.scss', {
style: 'compressed'
})
.pipe(rename({ suffix: '-min' }))
.pipe(gulp.dest('css/min'))
.pipe(reload({ stream: true }))
});
// Compile Woo Styles
gulp.task('woo_styles_min', function() {
return sass(['assets/woocommerce/scss/woocommerce-layout.scss', 'assets/woocommerce/scss/woocommerce.scss', 'assets/woocommerce/scss/woocommerce-smallscreen.scss'], {
style: 'compressed'
})
.pipe(rename({ suffix: '-min' }))
.pipe(gulp.dest('css/min'))
.pipe(reload({ stream: true }))
});
// Browser Sync
gulp.task('serve', function() {
browserSync.init( {
proxy: "http://" + config.url,
host: config.host,
notify: false,
});
});
// Watch Tasks
gulp.task('watch', function() {
// Styles & Scripts to be watched
gulp.watch('assets/js/*.js', ['scripts_min']);
gulp.watch('assets/scss/**/*.scss', ['styles']);
gulp.watch('assets/scss/**/*.scss', ['responsive_styles_min']);
gulp.watch('assets/scss/**/*.scss', ['rtl_styles_min']);
gulp.watch('assets/woocommerce/scss/**/*.scss', ['woo_styles_min']);
gulp.watch('assets/edd/scss/**/*.scss', ['edd_styles_min']);
// browserSync
gulp.watch('**/*.php').on('change', reload);
})
// Gulp
gulp.task('default', ['scripts_min', 'styles', 'responsive_styles_min', 'rtl_styles_min', 'edd_styles_min', 'woo_styles_min', 'watch', 'serve']);