回答編集履歴
2
修正
test
CHANGED
@@ -107,3 +107,39 @@
|
|
107
107
|
exports.build = series(compileSass, reload);
|
108
108
|
|
109
109
|
```
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
---
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
**追記**
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
```JavaScript
|
122
|
+
|
123
|
+
exports.default = () => {
|
124
|
+
|
125
|
+
browserSync.init({
|
126
|
+
|
127
|
+
browser: 'Google Chrome',
|
128
|
+
|
129
|
+
server: {
|
130
|
+
|
131
|
+
baseDir: './',
|
132
|
+
|
133
|
+
index: './index.html',
|
134
|
+
|
135
|
+
},
|
136
|
+
|
137
|
+
});
|
138
|
+
|
139
|
+
watch(path['sass']).on("change", (path) => series(compileSass.bind(this, path), reload)());
|
140
|
+
|
141
|
+
watch(Object.values(path).filter(value => value !== path["sass"]), reload);
|
142
|
+
|
143
|
+
};
|
144
|
+
|
145
|
+
```
|
1
修正
test
CHANGED
@@ -36,12 +36,6 @@
|
|
36
36
|
|
37
37
|
const browserSync = require("browser-sync");
|
38
38
|
|
39
|
-
const log = require("fancy-log");
|
40
|
-
|
41
|
-
const chalk = require("chalk");
|
42
|
-
|
43
|
-
const prettyTime = require("pretty-hrtime");
|
44
|
-
|
45
39
|
const path = {
|
46
40
|
|
47
41
|
html: "./*.html",
|
@@ -56,35 +50,17 @@
|
|
56
50
|
|
57
51
|
function compileSass(filePath) {
|
58
52
|
|
59
|
-
const time = process.hrtime();
|
60
|
-
|
61
|
-
log(`Starting '${chalk.cyan("compileSass")}' ...`);
|
62
|
-
|
63
|
-
|
64
|
-
|
65
53
|
return src(path["sass"])
|
66
54
|
|
67
55
|
.pipe(sass({outputStyle: "expanded"}))
|
68
56
|
|
69
|
-
.on("end",
|
57
|
+
.on("end", _ => {
|
70
58
|
|
71
|
-
if (typeof filePath === "
|
59
|
+
if (typeof filePath === "string") console.log(`Compiled '${filePath}'`);
|
72
|
-
|
73
|
-
log(`Compiled '${chalk.magenta(filePath)}'`);
|
74
|
-
|
75
|
-
}
|
76
60
|
|
77
61
|
})
|
78
62
|
|
79
63
|
.pipe(dest("css"))
|
80
|
-
|
81
|
-
.on("end", () => {
|
82
|
-
|
83
|
-
const duration = prettyTime(process.hrtime(time));
|
84
|
-
|
85
|
-
log(`Finished '${chalk.cyan("compileSass")}', after ${chalk.magenta(duration)}`);
|
86
|
-
|
87
|
-
});
|
88
64
|
|
89
65
|
}
|
90
66
|
|