forked from vitathemes/notation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
56 lines (47 loc) · 1.38 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
'use strict';
const {series, parallel} = require('gulp');
const browserSync = require('browser-sync').create();
const gulp = require('gulp');
const sass = require('gulp-sass');
const rtlcss = require('gulp-rtlcss');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
sass.compiler = require('node-sass');
const sassSrc = "./assets/src/sass/";
const jsSrc = "./assets/src/js/";
const cssDest = "./assets/css/";
const jsDest = "./assets/js/";
function clean(cb) {
// body omitted
cb();
}
function css(cb) {
return gulp.src(sassSrc + 'main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer({cascade: false}))
.pipe(gulp.dest(cssDest))
.pipe(browserSync.stream());
cb();
}
function rtlCss(cb) {
return gulp.src(cssDest + 'main.css')
.pipe(rtlcss())
.pipe(gulp.dest('dist'));
cb();
}
function rtlCssConcat(cb) {
return gulp.src(['./style.css', cssDest + "main.css"])
.pipe(concat('style-rtl.css'))
.pipe(gulp.dest('./'));
cb();
}
function liveServer(cb) {
browserSync.init({
proxy: 'notation.local'
});
gulp.watch([sassSrc + '**/*.scss']).on('change', gulp.series(css));
gulp.watch("./**/*.php").on('change', browserSync.reload);
cb();
}
exports.default = series(css, liveServer);
exports.rtlcss = series(rtlCss, rtlCssConcat);