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

Will there be AMD support? #50

Closed
ktei opened this issue Apr 26, 2015 · 5 comments
Closed

Will there be AMD support? #50

ktei opened this issue Apr 26, 2015 · 5 comments

Comments

@ktei
Copy link

ktei commented Apr 26, 2015

Hi, will there be AMD support so that requirejs can work? Cheers

@priyajeet
Copy link
Contributor

See #24. CommonJS + Browserify.
However if you need runtime dynamic module loading like AMD, you will probably need to create multiple browserify-ed bundles, and then choose/create any dynamic script loader to load those scripts. Or use the webpackify plugin.
http://esa-matti.suuronen.org/blog/2013/04/15/asynchronous-module-loading-with-browserify/

Alternatively you can just use webpack instead of browserify to create modules. And use AMD as you would normally do pull in a webpack module (that could be not just js). I haven't used it, but I am assuming thats how it would work.

@nzakas
Copy link
Contributor

nzakas commented Apr 26, 2015

@ktei can you explain what you mean by AMD support? Are you saying you'd like T3 to be available as an AMD module or something else?

@ktei
Copy link
Author

ktei commented Apr 26, 2015

@nzakas Sorry I think my question is a bit confusing. What I actually meant is these lines of code support (for example, in jquery.js)

if ( typeof define === "function" && define.amd ) {
    define( "jquery", [], function() {
        return jQuery;
    });
}

I should have said requirejs support ; )'

And isn't that it'd be better if it's T3.Application rather than Box.Application? though I know this framework is originated from your commercial project.

@mbinette
Copy link

The wrapper done for CommonJS should be expanded using the UMD standard block so that the wrapper can always be added and the files can be used in AMD, CommonJS, or VanillaJS. This page has very simple sample code showing what the header would look like. I'm not saying use Browserify (which can add this automatically). The method to handle CommonJS was to have a header.js and footer.js that can be added to the build in the make file. I think the header and footer simply need a little updating to work with all three methods and then the header and footer can always be added during make, even if you want Box on the global namespace.

http://dontkry.com/posts/code/browserify-and-the-universal-module-definition.html

@nzakas
Copy link
Contributor

nzakas commented Apr 27, 2015

@ktei we can look at adding this.

We've used Box.Application as we may release other libraries that also will use the Box namespace. We thought about adding an alias for T3, but it seems a little greedy to claim two global variables.

nzakas added a commit that referenced this issue Apr 28, 2015
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

No branches or pull requests

4 participants