jsframe.js
Summary
jsframe.js
converts a JavaScript input into a JavaScript/HTML polyglot output
that can be interpreted as either JavaScript or HTML. This allows you to
distribute a single file that can be loaded in a browser via either a script
element or an iframe
element.
Requirements
- npm
Installation
npm install -g jsframe
Usage
From the Command Line
jsframe my_javascript.js > my_polyglot.js.html
Programmatic
var fs = jsf = outFd = File; jsf;outFd;
Example
// my_javascript.jsif this === top console; else console;
# shell jsframe my_javascript.js > my_javascript.js.html