Quilt is very similar to the Sprockets JS preprocessor in that it allows you to improve code organization by logically separating your code into multiple modules within their own specific directories. Instead of having one massive JavaScript file with all your source code in it (increasing the potential for errors and complications), you can break out your code into separate physical files and at build time, allow Quilt to roll it all up, line by line, into a single file, ready for deployment. Via support for directives, you can tell Quilt about dependencies to ensure your builds are structured the right way.
In addition, if you use third-party frameworks in your code, Quilt allows you to specify a “load path” or “search path” which tells the preprocessor where to look for your specific lib. Then, when you build the final concatenated output, the library is included right in the source code.
Although Quilt was heavily inspired by Sprockets, it does have several significant differences. Perhaps the most obvious is that it’s written in pure JavaScript (as opposed to Ruby) and runs on Rhino. This means it’s very portable and easy for JS developers to understand. Quilt also uses a slightly different syntax than Sprockets for including files (for instance, it allows single-quoted pathnames, and uses backticks instead of angle brackets for specifying third-party code), and can strip multi-line comments as well as single-line ones.
As our client-side applications continue to grow, these types of solutions are becoming increasingly important for having a well-structured and maintainable codebase and it’s great to see that the future development leaders are taking that into consideration. Be sure to check out Quilt along with Kit’s other projects on GitHub.
Saikat Chakrabarti of Mockingbird is looking to make the tool collaborative. Along the way he wanted to test out tools to make this happen, and one test ended up with a collaborative drawing program using Node.js with WebSocket support from Socket.IO:
, the actual interesting parts that are doing anything other than serving static files start with the line “var listener = io.listen…”. On the client-side, I made a very simple Objective-J class that wraps the Socket.IO client called SCSocket (located in client/SCSocket.j). It’s up to you to simply set a delegate on this class and implement any of four methods (see setDelegate: on SCSocket) to handle notifications from the backend. To send notifications to the Node server, simple call [[SCSocket sharedSocket] sendMessage:].
This library builds on the shoulders of giants, one of which is Mr. Johnson, John Barnette who I had the pleasure of working with many moons ago. He is the person I think of when I remember that the best engineers that I have worked with haven’t been computer scientists, but musicians and biologists. He is also a great fun guy.
Anyway, sorry for the aside.
If you are a Rails chap, you may also be interested in the Rails plugin holygrail.