Hi James,

You've done a lot of nice work with require.js. At the moment, we haven't
committed to adding any sort of markup to our scripts to support this kind
of loading. We don't want to add the dependency graph to the overhead of the
download. At least not yet. We have moved away from scripts.json, which had
numerous limitations, and have adopted yaml headers that have "requires" and
"provides" values, which should make it possible for you to create a script
that automates the wrapping of any mootools code with your own. To
elaborate, you would need to parse the header of the file, and then output a
version with your syntax around its contents. This may or may not cause
issues where certain global variables are defined though.

Regardless, I don't think we'll be implementing this in MooTools itself yet.
I've forwarded your post on to our developer mailing list for further
discussion.

Thanks for sharing this. We'll give it more thought and stay in touch.

Aaron

On Mon, Feb 22, 2010 at 9:31 PM, James Burke <[email protected]> wrote:

> Hi,
>
> My name is James Burke, and I normally contribute to the Dojo Toolkit.
> However, I recently made a toolkit-agnostic loader, RequireJS:
> http://requirejs.org
>
> While it can be used without specific integration with MooTools, there
> are benefits with tighter integration, in particular making sure
> domready in MooTools waits for all scripts/modules to load. RequireJS
> uses dynamically created script src="" tags to load modules, which
> means they can finish after domready.
>
> RequireJS also has an optimization tool that can combine multiple
> modules into one. MooTools has a very nice web builder already. The
> RequireJS optimization tool is a great solution for projects with many
> files that build on top of MooTools Core/More.
>
> I believe the browser toolkits should try to use the same sort of
> script/module loader, one that works well in the browser. If not the
> same implementation then at least share the same loader format/API.
> Otherwise, I believe browser toolkits will get pressure over time to
> adopt the CommonJS module API, which does not work well natively in
> the browser.
>
> RequireJS compared to MooTools Depender: I believe they are similar in
> approach, but the dependencies for a module in RequireJS are specified
> within the module, there is not a separate file like scripts.json.
> RequireJS also tries to support some CommonJS idioms where it makes
> sense, and has a converter script that can convert a traditional
> CommonJS module into something that works well in the browser. So it
> will possible to reuse some CommonJS modules in the browser
> effectively. RequireJS does not have a server-backed loading option
> yet like Depender Server, but I am willing to get something like that
> to work.
>
> I have converted the Dojo codebase to use it via a conversion tool. I
> have done a fork of jQuery with unit tests that integrates RequireJS,
> but it is integrated as an optional component, the code can function
> without it.
>
> If you think this might be a useful module for integrating with
> MooTools, I am willing to do a fork of MooTools to integrate
> RequireJS, but I want to check with you all first to see if it might
> be a fit for your project. Also, I am open to changes in RequireJS, I
> do not consider the code frozen.
>
> Thank you,
> James
>

Reply via email to