npm install responserequire
options.js. When the input is determined to be HTML, either by checking the filename extension or
options.html, all the script tags which have the type attribute set to
text/require are extracted, joined and compiled using
var fs = ;var root = ;var responserequire = ;var app = ;app;app;
The module exposes an extra function which is mostly suited for development.
// Create a route and pass the script functionapp;
In a HTML file add a script tag whos src attribute points at the route. The specified script tags are compiled and inserted into the document.
<!-- ./index.html -->response.require test<!-- Type must be text/require, only script tags with that type will be compiled -->Hello
This is equivalent to doing the following on the server.
responserequire.script adds a more generic method of doing the above, which works with all HTML files, but requires multiple requests to the server.