-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (57 loc) · 2.03 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const sourceMaps = require('gulp-sourcemaps');
const autoprefixer = require('gulp-autoprefixer');
const browserSync = require('browser-sync')
const del = require('del')
//SCSS compilation
function styleMain() {
return gulp.src('./src/scss/*.scss')
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourceMaps.write('./'))
.pipe(gulp.dest('./src/css'))
.pipe(browserSync.stream())
}
function styleDemo() {
return gulp.src('./demo/assets/scss/*.scss')
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(autoprefixer())
.pipe(sourceMaps.write('./'))
.pipe(gulp.dest('./demo/assets/css'))
.pipe(browserSync.stream())
}
function watch() {
browserSync.init({
server: {
baseDir: './',
},
startPath: './demo/index.html',
ghostMode: false,
notify: false
});
gulp.watch('./src/scss/**/*.scss', styleMain);
gulp.watch('./demo/assets/scss/**/*.scss', styleDemo);
gulp.watch('./**/*.html').on('change', browserSync.reload);
gulp.watch('./assets/js/**/*.js').on('change', browserSync.reload);
}
function cleanVendors(){
return del('./assets/vendors/**/*');
}
function buildAddonVendors() {
var addon1 = gulp.src('./node_modules/bootstrap/**/*')
.pipe(gulp.dest('./assets/vendors/bootstrap'));
var addon2 = gulp.src('./node_modules/@mdi/**/*')
.pipe(gulp.dest('./assets/vendors/@mdi'));
var addon3 = gulp.src('./node_modules/jquery/**/*')
.pipe(gulp.dest('./assets/vendors/jquery'));
var addon4 = gulp.src('./node_modules/popper.js/**/*')
.pipe(gulp.dest('./assets/vendors/popper.js'));
return (addon1, addon2, addon3, addon4);
}
exports.style = gulp.parallel(styleMain, styleDemo);
exports.watch = watch;
exports.cleanVendors = cleanVendors;
exports.buildAddonVendors = gulp.series(cleanVendors, buildAddonVendors);