This repository has been archived by the owner on Dec 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
80 lines (68 loc) · 1.87 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
const browserSync = require('browser-sync').create();
const gulp = require('gulp');
const sass = require('gulp-sass');
const ejs = require('gulp-ejs');
gulp.task('copy-bootstrap', () => {
return gulp.src([
'node_modules/bootstrap/dist/**/*',
'!**/*.map'
])
.pipe(gulp.dest('dist/assets/3p/bootstrap'));
})
gulp.task('copy-fontawesome', () => {
return gulp.src([
'node_modules/font-awesome/**/*',
'!**/*.map'
])
.pipe(gulp.dest('dist/assets/3p/font-awesome'));
})
gulp.task('copy-jquery', () => {
return gulp.src([
'node_modules/jquery/dist/**/*',
'!**/*.map'
])
.pipe(gulp.dest('dist/assets/3p/jquery'));
})
gulp.task('copy-types', () => {
return gulp.src([
'node_modules/typed.js/lib/**/*',
'!**/*.map'
])
.pipe(gulp.dest('dist/assets/3p/typed.js'));
})
gulp.task('copy-img', () => {
return gulp.src('img/*')
.pipe(gulp.dest('dist/assets/img'));
})
gulp.task('copy', gulp.parallel([ 'copy-bootstrap', 'copy-fontawesome', 'copy-jquery', 'copy-types', 'copy-img' ]));
gulp.task('ejs', () => {
delete require.cache[require.resolve('./content')];
const content = require('./content');
return gulp.src('*.html')
.pipe(ejs(content))
.pipe(gulp.dest('dist'))
.pipe(browserSync.reload({
stream: true
}))
})
gulp.task('sass', () => {
return gulp.src('scss/main.scss')
.pipe(sass())
.pipe(gulp.dest('dist/assets/css'))
.pipe(browserSync.reload({
stream: true
}))
})
gulp.task('browserSync', () => {
return browserSync.init({
server: {
baseDir: './dist'
},
});
});
gulp.task('default', gulp.parallel(['copy', 'sass', 'ejs']));
gulp.task('dev', gulp.parallel(['browserSync', 'sass', 'ejs'], () => {
gulp.watch('scss/*.scss', gulp.series(['sass']));
gulp.watch('*.html', gulp.series(['ejs']));
gulp.watch('content.js', gulp.series(['ejs']));
}));