Skip to content

Instantly share code, notes, and snippets.

@kamiyam
Last active December 29, 2015 01:49
Show Gist options
  • Save kamiyam/7595797 to your computer and use it in GitHub Desktop.
Save kamiyam/7595797 to your computer and use it in GitHub Desktop.
ejs-locals と blocks.xxx を使った URLごとのスクリプトローディング
<div>
<!-- this block is main content area -->
</div>
<%
var fotter_script = (function () {/*
<script>
(function(d,w,$){
$(function(){
return false;
})
})(document,window,jQuery)
</script>
*/}).toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1];
%>
<% block('footer_scripts', fotter_script) -%>
<!DOCTYPE html>
<html>
<head>
<title>ejs-blocks-tips</title>
<%-scripts%>
<%-stylesheets%>
</head>
<body>
<%-blocks.header_scripts%>
<div id="content">
<%- body %>
</div>
<!--
Client-side Javascript
========================
-->
<%-blocks.footer_scripts%>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment