-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile_old.js
86 lines (75 loc) · 2.11 KB
/
gulpfile_old.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 gulp = require('gulp');
const notify = require('gulp-notify');
const plumber = require('gulp-plumber');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const pug = require('gulp-pug');
const browserSync = require('browser-sync');
const runSequence = require('run-sequence');
// setting:path
const paths = {
'scss': './src/scss',
'css':'./public/css',
'pug': './src/pug/',
'html': './public/',
'js':'./dist/js/'
}
// setting :Sass Option
const sassOptions = {
outoputStyle : 'compressed'
}
// setting :pug Opyions
const pugOptions = {
pretty: true
}
// sass compile
gulp.task('scss', () => {
gulp.src(`${paths.scss}*.scss`)
.pipe(plumber({ errorHandler: notify.onError("Error:<%=error.message %>") }))
.pipe(sass(sassOptions))
.pipe(autoprefixer())
.pipe(gulp.dest(paths.css))
});
// pug
gulp.task('pug', () => gulp.src([`${paths.pug}**/*.pug`, `!${paths.pug}**/_*.pug`])
.pipe(plumber({ errorHandler: notify.onError("Error:<%=error.message %>") }))
.pipe(pug(pugOptions))
.pipe(gulp.dest(paths.html))
);
// Browser Sync
gulp.task("browser-sync", () => {
browserSync({
server: {
baseDir: paths.html,
index: "vue-class-style.html"
}
});
gulp.watch([`${paths.js}**/*.js`, `${paths.html}**/*.html`, `${paths.css}**/*.css`], gulp.series('reload'));
});
gulp.task('reload', () => {
browserSync.reload();
});
const dir = {
'scss': "**/*.scss",
'pug': "**/*.pug",
'_pug': "**/_*.pug"
}
// watch
gulp.task('watch', () => {
gulp.watch(`${paths.scss}**/*.scss`, gulp.series('scss'));
gulp.watch([
`${paths.scss,dir.scss}`,
`${paths.pug,dir.pug}`,
`!${paths.pug,dir._pug}`],
gulp.parallel('scss', 'pug'));
});
gulp.task('default', gulp.parallel('browser-sync', 'watch'));
// // gulp.task('default', () => {
// // runSequence(
// // 'watch',
// // 'browser-sync'
// // )
// // });
// gulp.task('default', gulp.series(gulp.parallel('browser-sync', 'watch'), function () {
// // タスクの記述
// }));