0
私はテンプレートエンジンとしてEJSを使用しており、ページレイアウトの最後に1ページだけ必要なスクリプトをどのように取り入れるのか不思議です。EJSはページレイアウトの開始/終了時にスクリプトを含む
例:
レイアウト:
<head>
//Scripts and stuff
</head>
<body>
<article>
<%-body%> // Render page here
</article>
</body>
ページ:
//This script needs to go within the head of the layout
//Or before the closing </body> tag in the layout, but only
//when this particular page is loaded.
<script src="onlyRequiredOnThisPageWithinTheLayout.js"></script>
<p>Page content</p>
ありがとう!