ejsで、include(path)
しようとしているのですが、なぜか上手くいきません。
しばらく悩んでいたのですが、原因がわからず、困っています。
よろしくお願いします。
ファイル構成
components - _head.ejs main_amp.ejs
ごくごく単純で、componentsフォルダに小分けにしたejsファイルがあり、それをmain_amp.ejsでインクルードしようとしています。
main_amp.ejs
main_amp.ejs
1<!doctype html> 2<html ⚡ lang="ja"> 3 4<%- include('components/_head') %> 5 6<body> 7</body> 8</html>
components/_head.ejs
components/_head.ejs
1<head> 2 <meta charset="utf-8"> 3 <title>template</title> 4 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> 5 <%- include('css/_amp-boilerplate') %> 6 <style amp-custom> 7 </style> 8<head>
エラー内容
Error: ejs:4 2| <html ⚡ lang="ja"> 3| >> 4| <%- include('components/_head') %> 5| 6| <body> Could not find the include file "components/_head"
まずこのエラーの意味ですが、"components/_head" のパスにインクルードファイルが見つからないよってことですよね?
おそらく、すごくどこかで単純なミスをしている気がするのですが、わからないため、質問いたします。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。