回答編集履歴
1
Add gulpfile.js
answer
CHANGED
@@ -19,4 +19,43 @@
|
|
19
19
|
</body>
|
20
20
|
|
21
21
|
<%- include("common/_footer") %>
|
22
|
-
```
|
22
|
+
```
|
23
|
+
|
24
|
+
---
|
25
|
+
[追記]
|
26
|
+
`gulpfile.js`でejsのコンパイルをする設定が抜けていると思います。
|
27
|
+
|
28
|
+
```js
|
29
|
+
# 質問者さんの今のgulp.fileから抜粋
|
30
|
+
|
31
|
+
gulp.task("ejs", (done) => {
|
32
|
+
gulp
|
33
|
+
.src(["ejs/**/*.ejs", "!" + "ejs/**/_*.ejs"])
|
34
|
+
.pipe( plumber({ errorHandler: notify.onError("Error: <%= error.message %>") }) )//エラーチェック
|
35
|
+
.pipe(rename({extname: ".html"})) //拡張子をhtmlに
|
36
|
+
.pipe(gulp.dest("./")); //出力先
|
37
|
+
done();
|
38
|
+
});
|
39
|
+
```
|
40
|
+
|
41
|
+
gulp-ejsのREADMEにも書いてありますが、このような記述が必要です。
|
42
|
+
|
43
|
+
```js
|
44
|
+
# ejsを使うためのgulpファイルの設定例です。
|
45
|
+
var ejs = require("gulp-ejs")
|
46
|
+
|
47
|
+
gulp.src("./templates/*.ejs")
|
48
|
+
// 今の設定ファイルでは以下の記述が抜けています。
|
49
|
+
// ここから
|
50
|
+
.pipe(ejs({
|
51
|
+
msg: "Hello Gulp!"
|
52
|
+
}))
|
53
|
+
// ここまで
|
54
|
+
.pipe(gulp.dest("./dist"))
|
55
|
+
```
|
56
|
+
|
57
|
+
`gulpfile.js`にejsの設定を追加して、再度ビルドしてみてください。
|
58
|
+
|
59
|
+
参考リンク
|
60
|
+
- [Gulp + EJS初心者のつまづきポイントまとめ - Qiita](https://qiita.com/sygnas/items/6e7472667219522f9757#gulp%E3%81%AE%E8%A8%AD%E5%AE%9A)
|
61
|
+
- [rogeriopvl_gulp-ejs ???? Gulp plugin for ejs templates](https://github.com/rogeriopvl/gulp-ejs)
|