forked from 409H/archivennode-frontend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
55 lines (46 loc) · 1.33 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const del = require('del');
const deploy = require('gulp-gh-pages');
const src = "./src"
const dist = "./dist"
// Copy HTML files to dist
gulp.task('copy-html', () => {
return gulp.src(`${src}/**/*.html`)
.pipe(gulp.dest(dist))
})
// Copy JS files to dist
gulp.task('copy-js', () => {
return gulp.src(`${src}/**/*.js`)
.pipe(gulp.dest(dist))
})
// Copy images to dist
gulp.task('copy-images', () => {
return gulp.src(`${src}/images/**/*.{png,gif,jpg,svg}`)
.pipe(gulp.dest(`${dist}/images/`))
})
// Sass to css
gulp.task('styles', () => {
return gulp.src(`${src}/sass/**/*.scss`)
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(`${dist}/css/`));
});
// Clean the dist folder
gulp.task('clean', () => {
return del([
`${dist}/*`,
]);
});
// Deploy to Github pages
gulp.task('deploy', function () {
return gulp.src("./dist/**/*")
.pipe(deploy())
});
// Dev mode - watch for changes and recompile
gulp.task('watch', () => {
gulp.watch(`${src}/**/*`, (done) => {
gulp.series(['clean', 'copy-html', 'copy-js', 'copy-images', 'styles'])(done);
});
});
// Default talk - build everything for production
gulp.task('default', gulp.series(['clean', 'copy-html', 'copy-js', 'copy-images', 'styles']));