Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for onBuildRead. #114

Closed
wants to merge 1 commit into from

Conversation

benquarmby
Copy link

Resolves #113.

@@ -185,6 +185,10 @@ define(['module'], function (module) {
//Load the text. Use XHR if possible and in a browser.
if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
text.get(url, function (content) {
if (config && config.isBuild && config.onBuildRead) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be most logical place to put the onBuildRead hook, since it closes over all of the important variables starting with config.

@benquarmby
Copy link
Author

I've rebased my changes on top of the latest master. I feel this is still a relevant pull request a year later.

@benquarmby benquarmby closed this Apr 21, 2017
@ramon18
Copy link

ramon18 commented Jan 3, 2019

Indeed this pull request is still relevant 3 years later!
@jrburke Do you see any issues with this?

The current workaround is dynamically patch the "text" module:

 if (moduleName === "text") {
        var find = "text.finishLoad(name, parsed.strip, content, onLoad);";
        var replace = "if (config && config.isBuild && config.onBuildRead) { content = config.onBuildRead(name, url, content); }\n" + find;
        return contents.replace(find, replace);
      }

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants