, EJS , EJS. , script ( - )
, :
<% for (var i in scripts) { %>
<% if (!resources[scripts[i]]) { %>
<script src="<%= scripts[i] %>"></script>
<% resources[scripts[i]] = true %>
<% } %>
<% } %>
,
//file: "somepartial.ejs"
<html>
<head>
<%- partial("include.ejs", {
scripts: ["lib/jquery.js", "lib/bootstrap-tabs.js"]
}) %>
</head>
<body>
</body>
</html>
:
response.render('somepartial.ejs', {
resources: {},
});
, , script , - HTML-
, : AJAX,
$("#someDiv").load("/another/part/of/the/page.html");
, , AJAX, ( REST, ):
$("#someDiv").load("/another/part/of/the/page.html?resources={...}");
, , AJAX, , , , (, )