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

Adding AMD wrapper to lang files #485

Merged
merged 8 commits into from Dec 12, 2012
Merged

Adding AMD wrapper to lang files #485

merged 8 commits into from Dec 12, 2012

Conversation

timrwood
Copy link
Member

This addresses #128 and #479.

This changes the way language files are defined. Rather than adding the complex environment forking to each language file, the source files are instead only targeting Node.js.

Then, during the build process, the require('../moment') string is replaced with moment and is wrapped with the AMD/browser code.

// en.js source file
require('../moment').lang('en', {
    // the good stuff
});
// en.min.js file targeted towards browsers and Require.js
(function(){
    function onload (moment) {
        moment.lang('en', {
            // the good stuff
        });
    }
    if (typeof define === "function" && define.amd) {
        define(["moment"], onload);
    }
    if (typeof window !== "undefined" && window.moment) {
        onload(window.moment);
    }
})()

Thoughts @mlegenhausen, @Morriz, and @trondkla?

@timrwood
Copy link
Member Author

timrwood commented Nov 8, 2012

Pinging @mlegenhausen, @Morriz, and @trondkla. Any thoughts?

@trondkla
Copy link

trondkla commented Nov 8, 2012

Looks good!
Will try it out at job when I find the time to upgrade moment.js

@timrwood
Copy link
Member Author

Merging this in, this will go out in the 2.0.0 release

timrwood added a commit that referenced this pull request Dec 12, 2012
Adding AMD wrapper to lang files
@timrwood timrwood merged commit 5eccc8f into develop Dec 12, 2012
This was referenced Jan 3, 2013
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.

None yet

4 participants