Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mootools & nodejs

can i use mootools on the serverside with nodejs?

If so, can someone give an example?

like image 728
Tyler Gillies Avatar asked Aug 01 '10 08:08

Tyler Gillies


2 Answers

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

like image 175
Dimitar Christoff Avatar answered Sep 30 '22 03:09

Dimitar Christoff


Just to update this. If you have NPM installed you can just run:

npm install mootools

Then at the top of your node file just include:

require('mootools')

Source: https://github.com/vsviridov/mootools-node

like image 31
Adam Meyer Avatar answered Sep 30 '22 02:09

Adam Meyer