-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
41 lines (33 loc) · 1.01 KB
/
Copy pathgulpfile.js
File metadata and controls
41 lines (33 loc) · 1.01 KB
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
const path = require('path');
const gulp = require('gulp');
const sass = require('gulp-sass');
const gulpWebpack = require('webpack-stream');
const webpack = require('webpack');
const buildDir = './build';
function css() {
return gulp.src('./public/stylesheets/**/*')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./build/public/stylesheets'));
}
function js() {
return gulp.src('./public/javascripts/main.js')
.pipe(gulpWebpack(require('./webpack.config.js'), webpack)
.on('error', error => {
console.error(error);
this.emit('end');
}))
.pipe(gulp.dest('./build/public/javascripts'));
}
function fonts() {
return gulp.src('./public/fonts/**/*')
.pipe(gulp.dest('./build/public/fonts'));
}
const build = gulp.parallel(css, js, fonts);
function watch() {
const watcher = gulp.watch(['./public/**/*'], build);
watcher.on('change', file => {
console.log(`File ${file} was changed`);
});
}
exports.build = build;
exports.default = gulp.series(build, watch);