9 comments

[ 3.1 ms ] story [ 31.6 ms ] thread
Valmart's your FATHER, SubStack!

Edit: On a serious note, this looks really exciting, and I can't wait to give it a shot.

looks great. would be even better when it comes with automatic compression for bigger scripts.
Automatic compression isn't in there yet but you can compress the bundles using the "filter" option, which just takes a function that transforms the bundled source.
Everyone always asks this, but compression is most cleanly handled by your web server with Content-encoding: gzip, no? Why do we need to compress and minify markup and script files one at a time by hand?
Javascript compressors can intelligently remove blocks that general purpose stream compressors can't, like dead code or comments. Also because they understand the AST they can move code around to a limited extent to make the final output shorter.
From a novices perspective, could someone please explain: what is it? what does it do? why is it better than the alternatives? Thanks!
The CommonJS module specification uses the require() function to include modules. Because this function can take paths, it becomes difficult to share code between the server and the client without some workarounds.

What this module does (after a cursory glance) is:

1) intercept the request for browserify.js,

2) package all the necessary modules into a single file along with a require function that will link the modules to their identifiers, and

3) send the file to the client in a way that allows the calling document (in the case of the example, index.html) to use require() and module identifiers client side just as you would on the server side.

In short, this is a project which aims to lower the barrier between sharing code client and server side with node, as this ability to share code is one of node's greatest upsides in spite of the difficulties of doing so. I believe there are several other projects that perform similar tasks, but I have no direct experience with any of them.

Is it possible to use this with haml-js or jade to render client side templates? As in I want folder of .haml files and then be able to do var newView = require("templates/new");