-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
61 lines (49 loc) · 1.58 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
'use strict';
const gulp = require('gulp');
const concat = require('gulp-concat');
const browserSync = require('browser-sync').create();
const {watch} = require('gulp');
const rtlcss = require('gulp-rtlcss');
const rename = require("gulp-rename");
const sass = require('gulp-sass');
sass.compiler = require('node-sass');
const compileSass = (cb) => {
gulp.src('./assets/src/sass/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./assets/css'))
.pipe(browserSync.stream());
gulp.src('./assets/src/sass/woocommerce.scss')
.pipe(sass().on('error', sass.logError))
.pipe(rename("main-woocommerce.css"))
.pipe(gulp.dest('./assets/css'))
.pipe(browserSync.stream());
cb();
};
const buildRtl = (cb) => {
return gulp.src('./assets/css/main.css')
.pipe(rtlcss())
.pipe(rename("style-rtl.css"))
.pipe(gulp.dest('./'));
cb();
};
const concatJsFiles = (cb) => {
return gulp.src(['./node_modules/sticky-js/dist/sticky.min.js'])
.pipe(concat('vendor.min.js'))
.pipe(gulp.dest('./assets/js'));
cb();
};
const concatRtl = (cb) => {
return gulp.src(['./style-rtl.css', './assets/css/rtl.css'])
.pipe(concat('style-rtl.css'))
.pipe(gulp.dest('./'));
cb();
};
function liveServer(cb) {
browserSync.init({
proxy: 'shop.local'
});
watch(['./assets/src/sass/**/*.scss']).on('change', gulp.series(compileSass));
cb();
}
exports.default = gulp.series(compileSass, liveServer, concatJsFiles);
exports.rtlcss = gulp.series(buildRtl);