0
我正在使用EJS作爲模板引擎,並且想知道如何在頁面佈局的末尾包含僅在一個頁面上需要的腳本。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>
謝謝!