Skip to content

Instantly share code, notes, and snippets.

@gridwalk
Created July 22, 2015 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gridwalk/0647d7b1debd4c480ecb to your computer and use it in GitHub Desktop.
Save gridwalk/0647d7b1debd4c480ecb to your computer and use it in GitHub Desktop.
// This function is for including static HTML in a NWJS page. (Node Webkit)
// usage: <script>include('header.html');</script>
var include = function(file){
html = fs.readFileSync(file)
scripts = document.getElementsByTagName('script');
lastScript = scripts[scripts.length-1];
lastScript.insertAdjacentHTML("beforebegin", html);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment