Skip to content

Instantly share code, notes, and snippets.

@faceyspacey
Created December 7, 2015 16:30
Show Gist options
  • Save faceyspacey/aeec88dfd89aac63f0d5 to your computer and use it in GitHub Desktop.
Save faceyspacey/aeec88dfd89aac63f0d5 to your computer and use it in GitHub Desktop.
bla
Plugin.registerCompiler({
extensions: ['jsx'],
}, function () {
return new BabelCompiler({
react: true
});
});
var oldProcessFilesForTarget = BabelCompiler.prototype.processFilesForTarget;
var parentReg = /(<([A-Z][a-z0-9]+[\s\S]*?)(\/>|>))/g;
var lookupReg = /(?:this\.(\w+)\(([\s\S]*?)\))/g;
var parentReplace = "<$2 __parent={this} $3"; //allow for climbing component tree backwards via `__parent`
var lookupReplace = "this.__lookup('$1', [$2])"; //`this.__lookup` will perform method search utilizing `__parent`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment