-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
61 lines (47 loc) · 1.34 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
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const fileinclude = require('gulp-file-include');
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
// Static Server + watching scss/html files
gulp.task('serve', function() {
browserSync.init({
server: "./dist"
});
// sass
gulp.task('sass', function(){
return gulp.src('scss/**/*.scss', { sourcemaps: true })
.pipe(sass()) // Converts Sass to CSS with gulp-sass
.pipe(postcss([cssnano()]))
.pipe(gulp.dest('dist/css', { sourcemaps: '.' }))
.pipe(browserSync.stream());
});
gulp.watch('./scss/**/*.scss', gulp.series(['sass']));
gulp.watch('*.html').on('change', browserSync.reload);
});
// html includes
const paths = {
scripts: {
src: './',
dest: './dist/'
}
};
async function includeHTML(){
return gulp.src([
'*.html',
'!nav.html', // ignore
'!install.html', // ignore
'!nav-new.html', // ignore
'!current-ex.html', // ignore
'!current-ex-new.html', // ignore
'!header.html', // ignore
'!footer.html' // ignore
])
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest(paths.scripts.dest));
}
exports.default = includeHTML;