-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
96 lines (88 loc) · 2.92 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
const gulp = require('gulp');
const autoprefixer = require('autoprefixer');
const browsersync = require('browser-sync').create();
const cssnano = require('cssnano');
const plumber = require('gulp-plumber');
const postcss = require('gulp-postcss');
const rename = require('gulp-rename');
const sass = require('gulp-sass');
var merge = require('merge-stream');
var sourcemaps = require('gulp-sourcemaps');
function browserSync(done) {
browsersync.init({
server: {
baseDir: './',
},
port: 3000,
});
done();
}
function css() {
return gulp
.src('scss/style.scss')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass({ outputStyle: 'expanded' }))
.pipe(gulp.dest('css/'))
.pipe(rename({ suffix: '.min' }))
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('css/'))
.pipe(browsersync.stream());
}
function watchFiles() {
gulp.watch('scss/*.scss', css);
gulp.browserSyncReload;
}
const watch = gulp.parallel(watchFiles, browserSync);
exports.css = css;
exports.watch = watch;
exports.serve = browserSync;
/*Scripts for addons*/
gulp.task('copyAddonsScripts', function () {
var aScript1 = gulp
.src(['node_modules/jquery/dist/jquery.min.js'])
.pipe(gulp.dest('vendors/jquery'));
var aScript2 = gulp
.src(['node_modules/bootstrap/dist/js/bootstrap.min.js'])
.pipe(gulp.dest('vendors/bootstrap'));
var aScript3 = gulp
.src(['node_modules/popper.js/dist/popper.min.js'])
.pipe(gulp.dest('vendors/popper'));
var aScript4 = gulp
.src(['node_modules/owl.carousel/dist/owl.carousel.min.js'])
.pipe(gulp.dest('vendors/owl-carousel/js'));
var aScript5 = gulp
.src(['node_modules/aos/dist/aos.js'])
.pipe(gulp.dest('vendors/aos/js'));
var aScript5 = gulp
.src(['node_modules/bootstrap/* '])
.pipe(gulp.dest('vendors/bootstrap'));
return merge(aScript1, aScript2, aScript3, aScript4, aScript5);
});
/*Styles for addons*/
gulp.task('copyAddonsStyles', function () {
var aStyle1 = gulp
.src(['node_modules/mdi/css/materialdesignicons.min.css'])
.pipe(gulp.dest('vendors/mdi/css'));
var aStyle2 = gulp
.src(['node_modules/bootstrap/scss/bootstrap.scss'])
.pipe(gulp.dest('vendors/bootstrap/scss'));
var aStyle3 = gulp
.src(['node_modules/owl.carousel/dist/assets/owl.carousel.min.css'])
.pipe(gulp.dest('vendors/owl-carousel/css'));
var aStyle4 = gulp
.src(['node_modules/owl.carousel/dist/assets/owl.theme.default.css'])
.pipe(gulp.dest('vendors/owl-carousel/css'));
var aStyle5 = gulp
.src(['node_modules/aos/dist/aos.css'])
.pipe(gulp.dest('vendors/aos/css'));
return merge(aStyle1, aStyle2, aStyle3, aStyle4, aStyle5);
});
// gulp.task('build', function () {
// gulp.src('index.html').pipe(gulp.dest('dist'));
// });
// gulp.task('build', function (callback) {
// 'clean:dist', ['sass', 'useref', 'images', 'fonts'];
// });
gulp.task('build', ['css', 'js', 'imgs']);