Anyone else using Server-side Mootools?

39 views
Skip to first unread message

Offroadcode

unread,
Jan 5, 2010, 2:58:07 PM1/5/10
to MooTools Users
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

Christoph Pojer

unread,
Jan 5, 2010, 5:26:21 PM1/5/10
to MooTools Users
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.

para

unread,
Jan 6, 2010, 6:38:38 AM1/6/10
to MooTools Users
Hi,

We are using it in APE Project (http://www.ape-project.org/). Our
webserver ships with spidermonkey and MooTools.

Btw, it's not CommonJS complient yet. (Hope for the next release ;))

Anthony

On Jan 5, 8:58 pm, Offroadcode <pete.duncan...@googlemail.com> wrote:

gabriel munteanu

unread,
Jan 6, 2010, 12:33:07 PM1/6/10
to mootool...@googlegroups.com
i am using mootools with rhino on the server-side in a game.
i am doing all the logic and hold all the data model in JS, both on
the server and in the browser, and it is easy to maintain now.

--
jgabios
http://bash.editia.info

ken

unread,
Jan 6, 2010, 9:44:14 PM1/6/10
to MooTools Users
Check raccoon. keetology.com is mootools powered.

Pete Duncanson

unread,
Jan 7, 2010, 5:49:09 AM1/7/10
to mootool...@googlegroups.com
Excellent stuff! Theres me thinking I was the only one using it commercially.

Still trying to get my head around how the CommonJS stuff works, on first look it seems to not want you to modify any of the Native objects which would be a pain, no .each() etc. available without some hoop jumping. We could end up lots of a lovely modules that all use different frameworks which could really be a bind and lead to bloat. That or we end up with a unified version (which I guess is what CommonJS is about but theres no mention of a spec as yet) which would seem sensible but a sticky problem to start as it will be a mind field of X does it like this, Y does it like that style wars.

In our ASP code we've been using Response.Write's to push stuff to the response stream but after finding Jack and JSON Template I'm now thinking of creating a new code of our code that tries to emulate this somewhat with a final Response.Write at the end of the script. Also had an idea to create a XML Document for each page which could be loaded from a static (or multiple statics) and then you could do Element goodness with server-side before you write it down to the Response Stream, this would give client-side coders a leg up on how to do Server-Side as most of the DOM functions would be the same. Is that an insane idea? I'm still pondering it :)

Believe it or not the XML manipulation stuff is pretty damn fast on ASP (MS got the guy who wrote the MS DOM stuff in for the re-write of their .net implementation as their initial version was massively slower than the old COM version). All the talk of ASP being slow tends to be based on old articles from 10 years ago. On modern machines in the real world its fantastically fast and really, really good fun to code with :)

Pete

Thomas Aylott

unread,
Jan 7, 2010, 12:08:14 PM1/7/10
to mootool...@googlegroups.com
So you're using server-side JScript on IIS with asp?

Very cool

— Thomas Aylott
   SubtleGradient
   MooTools

Pete Duncanson

unread,
Jan 7, 2010, 1:04:22 PM1/7/10
to mootool...@googlegroups.com
Yep, its super easy to get started too:

<%@ Language="JScript" %>
<%

for( var i=0; i < 10; i++ ) {
  Response.Write( "<br />" + i + " - MooTool Server-side!" );
}

// Alt syntax
for( var i=0; i < 10; i++ ) {
  %>
  <br />
  <%= i %> -  MooTool Server-side!
  <%
}

%>

If you include the Mootools server-side cut then you get Class, String goodies, etc too. simply include a SSI at the top of your file:

<%@Language="JScript" %>
<!--#include file="mootools.asp"-->
<%
// your code here
%>

You do need to wrap the mootools code in <% %> for the server to know its ASP though.

ASP used to get a terrible rep for all the mixing of code/presentation and repetition but if you put some thought into it you can come up with some cracking apps that are nice and clean. Plus you can build up some nice libraries too esp. when using mootools Class :)

My trouble is I struggle with the *nux stuff as I've been coding on MS stuff for 15 years. But as JS runs in all browsers its been great to see/use/expand all the client-side developments of recent years server side. Out biggest clients site is all JScript ASP and no sign of it going anywhere, and why should it. Its plenty fast enough and with a little patching up with .net where it does struggle (we have a .net image resizer and XML cacher layer for our CMS) it gets better and better. Anyway, I wondered if a ASP solution (following CommonJS if possible) would help more MS boys like me take interest?

I will say this though, coding server side in JS just puts a smile on my face, far more fun than .net :)

Pete

Roman Land

unread,
Jan 7, 2010, 1:20:35 PM1/7/10
to mootool...@googlegroups.com
Is it just me or the lack of code completion is annoying?

Especially when writing big projects, not being able to see methods and properties from other classes is annoying..

Anyway, I doubt code completion can be done with JS..
--
---
"Make everything as simple as possible, but not simpler."

- Albert Einstein

Pete Duncanson

unread,
Jan 7, 2010, 2:22:35 PM1/7/10
to mootool...@googlegroups.com
In JS in general or in Server-side JS?

I code quite happily using just Textpad, have done for years. Guess its what you used to. Don't get me wrong I love going back to Visual Studio for .net (as the framework is simply too big!) but JS is a small enough subset that I can be productive enough. That said a bit more code complete would be good, if it makes me more productive then all the better.

Thomas Aylott

unread,
Jan 7, 2010, 5:40:42 PM1/7/10
to mootool...@googlegroups.com
Check this out, i sure will:

CommonJS Modules support for ASP JScript!

— Thomas Aylott
   SubtleGradient
   MooTools

Christoph Pojer

unread,
Jan 7, 2010, 6:44:47 PM1/7/10
to MooTools Users
I am very happy to see that MooTools is already used in various places
other than the Browser. If you encounter any problems specific to the
environment feel free to get in contact with us. If you have written
server side stuff, feel free to share the experience. We are very
eager to see what cool things you are all working on :)

On Jan 7, 11:40 pm, Thomas Aylott <oblivi...@subtlegradient.com>
wrote:

Pete Duncanson

unread,
Jan 8, 2010, 5:25:47 AM1/8/10
to mootool...@googlegroups.com
I'd already seen the Module stuff but Smith, he's not worked on it in a while though so I might take up the challenge. Modules is just the first part though, theres I/O, Files etc. that all still need writing as well before you can start building some good stuff. Then you could start using the Narwhal goodies on top of your CommonJS stack :)

Will have a go at getting some of my hacked up half finished projects together to show you all :)

Pete
Reply all
Reply to author
Forward
0 new messages