evanmoran / oj

Unified web templating for the people. Thirsty people.
MIT License
445 stars 7 forks source link

Express Plugin #1

Closed evanmoran closed 9 years ago

evanmoran commented 11 years ago

This plugin is in the works. The main challenge is improving performance through caching.

It turns out a gigantic amount of time is taken up in require traversal (which cannot be async) and minification (which can be). Both of these can be cached but it will take time to factor out traversal and minification from compiling.

dminkovsky commented 10 years ago

This would be amazing. Generating DOM via OJ, server-side would be fantastic. Thanks for the OJ we do have, in the meantime.

evanmoran commented 10 years ago

@dminkovsky Much appreciated! I have a proof of concept working already and it is even faster then expected. Lot's to do, but never fear that this is my #1 priority!

dminkovsky commented 10 years ago

Really stoked, Evan. Really. Discovering OJ for me has sort of been like finding the holy grail. I can't believe people still write HTML, myself included. I've wanted something like OJ for a very long time.

A server-side OJ setup seems to have so many implications: not only (i) no more HTML templating, but simpler unification of DOM-generating code, which is what so many people are going for all over the place. But also (ii), there have been a lot of people clanging together PhantomJS with Express middleware just because their pages are generated exclusively on the client side. Am I off-base in thinking that OJ on Node would be a big step in solving this cleanly?

What are you using for DOM in this Node version?

evanmoran commented 10 years ago

I'm really glad you like it man. I completely agree server-side is the way OJ was meant to be used. Though, if I may say, it's even better then you know=).

OJ doesn't need anything for server-side DOM manipulation since it can template directly to HTML and CSS! So server-side it directly creates html/css (for seo) and client side it does direct dom manipulation (for speed and event binding)

Just for you I created this example of OJ creating html / css directly: http://jsfiddle.net/evanmoran/tABjv/

The oj.toHTML and oj.toCSS methods are just special cases of oj.compile, with options set to only compiles html or css respectively. Server side this is done for you with the oj commandline tool (and soon with express!).

Jump on IRC freenode.net#oj at some point if you want to talk about it. I'd be glad to give you a demo of the oj commandline tool (npm install -g oj) or answer any questions!

dminkovsky commented 10 years ago

Hey, really looking forward to checking it out! I'm still running through basic client-side usage, and looking forward to getting to know the codebase as I work with the API.

I hopped onto #oj but it looks like it's just me (dimadima) and @Chanserv. Anyway, I'm on IRC 24/7 so I'll hang out in #oj. Looking forward!

dminkovsky commented 10 years ago

Hey saw your post in #oj. Sweet man--I'll see you whenever you're around. I use Irssi+tmux/screen on a box that's up all the time, so I never miss scroll. Check it out of you've got time.

dminkovsky commented 10 years ago

Hi Evan,

Saw your messages on IRC re: this. Exciting.

Right now I'm in the midst of a heavy wave of client work. Will be out from under it in the next few weeks hopefully.

Looking forward to taking a look! Dmitry

evanmoran commented 10 years ago

This is complete but the documentation hasn't been written.

dminkovsky commented 10 years ago

Hey man! Just saw your messages on IRC. I've been on a programming hiatus for the holidays. Finished some client work and just taking a few days away from the computer. Happy New Year to you! Catch you on IRC in 2014?

evanmoran commented 10 years ago

Definitely, I should be on around the 5-6th. 2014 is the year of OJ =)

evanmoran commented 9 years ago

Express support is in. Enjoy!