-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
86 lines (73 loc) · 2.12 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
const { src, dest, watch, parallel, series } = require('gulp');
const scss = require('gulp-sass')(require('sass'));
const htmlChunk = require('gulp-file-include');
const concat = require('gulp-concat');
const autoprefixer = require('gulp-autoprefixer');
const uglify = require('gulp-uglify');
const del = require('del');
const browserSync = require('browser-sync').create();
function browsersync() {
browserSync.init({
server: {
baseDir: 'app/'
},
notify: false
});
}
function htmlInclude() {
return src('app/html/*.html')
.pipe(htmlChunk())
.pipe(dest('app'))
.pipe(browserSync.stream());
}
function styles() {
return src('app/scss/style.scss')
.pipe(scss({ outputStyle: 'compressed' }))
.pipe(concat('style.min.css'))
.pipe(autoprefixer({
overrideBrowserslist: ['last 10 versions'],
grid: true
}))
.pipe(dest('app/css'))
.pipe(browserSync.stream())
}
function scripts() {
return src([
'node_modules/swiper/swiper-bundle.min.js',
'node_modules/modal-video/js/modal-video.min.js',
'node_modules/parallax-js/dist/parallax.min.js',
'node_modules/wow.js/dist/wow.min.js',
'app/js/main.js'
])
.pipe(concat('main.min.js'))
.pipe(uglify())
.pipe(dest('app/js'))
.pipe(browserSync.stream())
}
function build() {
return src([
'app/*.html',
'app/css/style.min.css',
'app/js/main.min.js',
'app/images/**/*.*',
'app/fonts/**/*.*',
], { base: 'app' })
.pipe(dest('dist'))
}
function cleanDist() {
return del('dist')
}
function watching() {
watch(['app/html/**/*.html'], htmlInclude);
watch(['app/scss/**/*.scss'], styles);
watch(['app/js/**/*.js', '!app/js/main.min.js'], scripts);
watch(['app/**/*.html']).on('change', browserSync.reload);
}
exports.htmlInclude = htmlInclude;
exports.styles = styles;
exports.scripts = scripts;
exports.browsersync = browsersync;
exports.watching = watching;
exports.cleanDist = cleanDist;
exports.build = series(cleanDist, build);
exports.default = parallel(htmlInclude, styles, scripts, browsersync, watching);