Browserify plugin for Google Apps Script.
About
In Google Apps Script, it must be top level function declaration that entry point called from google.script.run.
When gasify
detect a function assignment expression to global
object. it generate a top level function declaration statement.
example
main.js:
var echo = ;globalecho = echo;
echo.js:
module.exports = function(message) {
return message;
}
build:
$ browserify main.js -p gasify -o Code.gs
Code.gs
var global = this; {}{{if!noif!tovar a=typeof require=="function"&&require;if!u&&areturn ;ifireturn ;var f="Cannot find module '"+o+"'";throw fcode="MODULE_NOT_FOUND"fvar l=no=exports:{};to0return noexports}var i=typeof require=="function"&&require;forvar o=0;o<rlength;o++;return s}1:{module { return message;}; }{}2:{{var echo = ;globalecho = echo; }}"./echo":1{}2;
Installation
$ npm install gasify
Usage
CLI
$ browserify main.js -p gasify -o Code.gs
Options
The following options can be set via the API or command-line:
comment
{Boolean}: If true
then generate a top level function declaration statement with comment. Default is true
.