Skip to content

Instantly share code, notes, and snippets.

@madbook
Created May 26, 2015 20:38
Show Gist options
  • Save madbook/7980a0d70705e7858733 to your computer and use it in GitHub Desktop.
Save madbook/7980a0d70705e7858733 to your computer and use it in GitHub Desktop.
js multiline string function hack
function _multiline(fnc) {
return fnc.toString().replace(/^function *\(\) *\{ *\/\* */, '').replace(/ *\*\/ *\} *$/, '');
}
// example
var template = _multiline(function(){/*
<div id="some_id">
<h1>Multiline strings without all the bullshit</h1>
<p>This is a pretty terrible hack, probably don't actually do this ever.</p>
</div>
*/});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment