Search code examples
javascriptmootoolsnode.js

mootools & nodejs


can i use mootools on the serverside with nodejs?

If so, can someone give an example?


Solution

  • Out of date: http://davidwalsh.name/mootools-nodejs

    The correct way now is via the npm, which is actually upto date.

    npm install mootools --save
    

    using it:

    require("mootools");
    // globals exported and types shimmed
    var foo = new Class({}); // etc
    

    things not exported: Element protos, Fx, Slick (and parser), Request (XHR), Swiff etc - if it touches the DOM, it won't be there.

    Still, given the JS implementation under nodejs is pretty awesome anyway, shimming is not required (other than some sugar methods) and for Class, you can use prime - npm install prime - see https://github.com/mootools/prime/

    example on RequireBin: http://requirebin.com/?gist=5957603