Thanks for the gist, looks nice. Also thanks for node-dev, I'll be sure to
play with it
Den mandag den 16. juli 2012 14.17.07 UTC+2 skrev Aseem Kishore:
> Hey Nik,
> CoffeeScript and Streamline both come with a require() hook that lets you
> simply require() your .coffee and ._js/._coffee files as if they were
> regular .js files, compiling them on the fly each time.
> So you can have your top-level JS (e.g. app.js or server.js) simply
> register these hooks and then require() your files like normal:
> // e.g. app.js
> require('coffee-script'); // registers automatically
> require('streamline').register();
> require('./app._coffee');
> // app._coffee
> console.log 'hello...'
> setTimeout _, 1000
> console.log '...world'
> The only downside to this approach is that each compilation takes a bit of
> time. Streamline has support for caching built-in if you pass {cache:
> true}, to the register() call.
> But that doesn't cache the CoffeeScript compilation, and the cache doesn't
> keep up with CoffeeScript version changes, so I made a little helper a
> while back to do a bit smarter caching for both:
> https://github.com/aseemk/coffee-streamline
> We use this with node-dev, a really robust supervisor I've come to really
> love:
> https://github.com/fgnass/node-dev
> And it works great. This is our "top-level" JS file:
> https://gist.github.com/1068606
> I've been meaning to ask Bruno about whether it might make sense for some
> of this better CoffeeScript support / smarter caching to be in Streamline
> proper, so it'd be great to get your thoughts.
> Hope this helps!
> Aseem
> On Sun, Jul 15, 2012 at 6:28 PM, niklassaers <njstrif...@gmail.com> wrote:
>> Hi guys,
>> I'm an ObjC guy diving into Node for the summer. When I write Node, I use
>> CoffeeScript, and while working I use supervisor to make sure everything is
>> compiled right away.
>> How do I best make streamline.js fit into this workflow? Ideally, I'll
>> just add _coffee to --extensions at the supervisor command line and be done
>> with it. But how do I make Node compile the streamline'd coffee files
>> before reloading?
>> Cheers
>> Nik