Hey, we aim to fully support CommonJS with our 2.0 release. However there are some problems with "undefined behavior" in the CommonJS where they do not actually specify if something is allowed or not. And that sucks and I hope that we can push forward some proposals to avoid any upcoming problems.
I have, in my branch of 2.0, a working version for MooTools in a commonJS environment. I have tested it in NodeJS so far: http://github.com/cpojer/mootools-core/tree/2.0wip (Good thing I did not get killed for the proposal). Look at this for a usage example: http://github.com/cpojer/mootools-core/tree/58b4a1df9d849b50e51a3b77f85a39d1a329de84/Source/Class/Class.js Basically you just need to do var MT = require('path/To/Source/MooTools'); and you get everything MooTools on that object. Then you can go on by doing var Class = MT.Class; and use it inside a module as you are used to. Please note that I may change this approach completely in the next few days to make it even easier. As said above what I'm doing there is "undefined" by commonJS, so it may or may not work. The base of MooTools 2.0 is very stable. You can use it with serverside JavaScript today. 2.0 worked already without that change in most commonJS environments but just because most of them allow to append objects to the global variable. I want MooTools to fully comply with the specs. After all, you can expect official support for serverside MooTools. On Jan 5, 8:58 pm, Offroadcode <[email protected]> wrote: > Hi all, > > Just putting some feelers out to see if anyone else is using Mootools > server side? I've been playing with it in Classic ASP (which allows > you to run JScript instead of VBScript). Its very fast and its lovely > having the Moo goodness server side. I know some folk are using it > with Rhino etc. would love to hear from others having some server side > fun. > > Any views on CommonJS for Moo? Only found this the other day be very > interested, still digesting it all at the minute though :) > > Cheers > > Pete
