Skip to content
Browse files

Allow CoffeeScript to be hookable.

  • Loading branch information...
1 parent 9234585 commit cc402a483e0a54c60a6a9fa66782cfa55901b37b @stas committed Mar 18, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 nodify.js
View
8 nodify.js
@@ -26,7 +26,7 @@ var global = window, process;
var rootPath = fs.absolute(phantom.libraryPath);
var nodifyPath = joinPath(rootPath, dirname(nodify));
var sourceIds = {};
- nodify = {};
+ nodify = { _useCoffeeScript: false };
function getErrorMessage(e, withMessage) {
withMessage = typeof withMessage === 'undefined' ? true : withMessage;
@@ -38,7 +38,6 @@ var global = window, process;
// TODO: remove when PhantomJS has full module support
function patchRequire() {
- phantom.injectJs(joinPath(nodifyPath, 'coffee-script.js'));
var phantomRequire = nodify.__orig__require = require;
var requireDir = rootPath;
var requireCache = {};
@@ -251,6 +250,11 @@ var global = window, process;
phantom.exit(1);
}
};
+
+ nodify.enableCoffeeScript = function() {
+ phantom.injectJs(joinPath(nodifyPath, 'coffee-script.js'));
+ nodify._useCoffeeScript = true;
+ };
}());

0 comments on commit cc402a4

Please sign in to comment.
Something went wrong with that request. Please try again.