Skip to content

Instantly share code, notes, and snippets.

@yoko
Created June 13, 2011 06:46
Show Gist options
  • Save yoko/1022395 to your computer and use it in GitHub Desktop.
Save yoko/1022395 to your computer and use it in GitHub Desktop.
jQuery.tmpl.tag['script'] = {
open : "if('$2'){__.push('<script $2></script>');}else{__.push('<script>');}",
close: "__.push('</script>');"
};
<script id="template-script-test" type="text/x-jquery-tmpl">
{{script}}console.log(1 + 1);{{/script}}
{{script(src="foo.js")}}
{{script(src="foo.js" charset="utf-8")}}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment