If you are developing with closure library you should have a and phantomjs, then you might want to include some of you’re development code into the phantomjs runtime. It turns out you could hack into the goog.provide/require statements to override the IMPORT function.

The following code will make the entire goog.* namespace available to be required via goog.require().

varfs=require('fs');// the relative path to the goog folder.CLOSURE_BASE_PATH='src/closure-library/closure/goog/';// the function to inject scripts.CLOSURE_IMPORT_SCRIPT=function(src){returnphantom.injectJs(fs.absolute(src));};// import the base.js file.CLOSURE_IMPORT_SCRIPT(fs.join(CLOSURE_BASE_PATH,'base.js'));

If you also parts of your own codebase, you will need to load the relevant deps.js files.