-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
66 lines (60 loc) · 1.59 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
var gulp = require('gulp');
const {
series,
parallel,
src,
dest,
task,
watch,
start
} = gulp;
// Requires the gulp-sass plugin
var sass = require('gulp-sass');
let cleanCSS = require('gulp-clean-css');
const webpack = require('webpack-stream');
const minify = require('gulp-minify');
task('compileJavascript', async function () {
return src('resources/js/app.js')
.pipe(webpack({
output: {
filename: 'app.js'
}
}))
.pipe(dest('assets/js'));
});
task('compileSass', async function () {
return src('resources/scss/app.scss')
.pipe(sass({
includePaths: ['./node_modules/']
}))
.pipe(dest('assets/css'));
});
task('production', async function () {
return parallel(
function () {
return src('resources/scss/app.scss')
.pipe(sass({
includePaths: ['./node_modules/']
}))
.pipe(cleanCSS())
.pipe(dest('assets/css'));
},
function () {
return src('resources/js/app.js')
.pipe(webpack({
output: {
filename: 'app.js'
}
}))
.pipe(minify())
.pipe(dest('assets/js'));
}
)
});
task('watch', function () {
watch('resources/scss/*.scss', parallel('compileSass'));
watch('resources/js/app.js', parallel('compileJavascript'));
});
task('default', async function () {
return parallel('compileSass', 'compileJavascript')
});