Strip AMD ceremony from builds? #152

Closed
jreading opened this Issue Apr 20, 2012 · 3 comments

Comments

Projects
None yet
2 participants

Forgive me if I missed this (or I'm missing something else), but is it possible to remove the amd wrappers from modules and not need require.js or almond.js with the builds?

for ex:

define(['modules/mymodule'],function(mymodule) {
    var myothermodule = (function(){
    //stuff
    })();
});

would just become:


var mymodule = (function(){
    //stuff
})();

var myothermodule = (function(){
    //stuff 
})();

Owner

jrburke commented Apr 20, 2012

You can do this by implementing an onBuildWrite post processing function. A nice blog post about onBuildRead and onBuildWrite here:
http://www.ericfeminella.com/blog/2012/03/24/preprocessing-modules-with-requirejs-optimizer/

I have a larger working example here:
https://github.com/jrburke/mvclib-template/blob/master/tools/build.js#L64

where I transform the define() calls instead of strip them, but might be something to start with.

jrburke closed this Apr 20, 2012

excellent, thanks. I saw that actually, but wasn't sure if it was already implemented.
I'm also looking to replace objects that are a result of extending the dependency (like here: http://hellowurld.heroku.com/blog/2012/04/19/responsive-modules/), so I'll dig in.

Owner

jrburke commented Apr 20, 2012

Yes, it should be good to go if you are using at least 1.0.7 of r.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment