That version doesn't work... :P Which is why I pointed you to the version I had in my project.. underscore removed CommonJS bindings... there's a long thread on that on a google group somewhere...

I dug up some previous version that still had the CommonJS bindings....  which was here:

you'll need to dump it into the views/lib directory and make sure your kanso.json has modules dependency:

    "load": "lib/app",
    "dependencies": {
        "modules": null,
        "properties": null

then require in your view would be:

var _ = require("views/lib/underscore-min");

You can take a look at this kanso app as an example:

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International
t. @nsomnac

On Aug 17, 2012, at 5:26 PM, AL wrote:

Thanks again,

again it fails... with:

Any other suggestion?


On 18/08/2012 02:08, Zera Holladay wrote:
Last suggestion, try sticking an AMD-ified version of underscore in
lib and load it like:

_ = require("lib/underscore").

I don't really know Kanso, but the only example shows libraries in
html only.  However, Sofa uses a server-side require in
validate_doc_update like the kind I'm asking you to try.  I might be
dead wrong about all of the above, but maybe this response will get
someone more knowledgeable than me to respond if I am.


On Fri, Aug 17, 2012 at 7:55 PM, AL <> wrote:
thanks, unfortunately no more chance. :(


On 18/08/2012 01:11, Zera Holladay wrote:

Try changing:

var _ = require('underscore')._;


_ = require('underscore');


On Fri, Aug 17, 2012 at 7:05 PM, AL <>

Thanks Jim and Ryan,

kanso seems quite interesting indeed :)

I have started a small project based on it, but unfortunately I haven't
able to solve my problem.

I was wondering if the folks on the list could have a look at it? I
can't spot the problem...

The project is available here:

Visiting the following URL will log variable `_`, which is undefined in

Thanks a lot,


On 06/08/2012 19:40, Ryan Ramage wrote:


If you are making a couchapp, and you want to use underscore, you
should give a try. There is a kanso package already for

Kanso makes using commonjs modules very easy, and there are lots of
packages already available.


On Mon, Aug 6, 2012 at 11:26 AM, Jim Klo <> wrote:

Hmm... I'm using underscore.js in my views and lists...  maybe snake
version I'm using?

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International
t. @nsomnac

On Aug 6, 2012, at 10:17 AM, AL wrote:

Hi all,

I'm running archlinux and couchdb 1.2. I'm trying to develop a
although I could use couchdb only as a database, I like the idea of
"self-containess" in couchapps. The application I want to build is
simple, consisting of list and detail views. I have a set of books
in a bibtex-like fashion, and I'm trying to serve a webpage that lists
whole collection, organized by year. Here is my view map:

     function(doc) {
       if (doc.application === "publication") {
         emit([doc.year, doc.title], doc);

I'd like to get a webpage consisting of several ul tags; one for every
The getrow() function makes it easy to make one big list (1. opening
list, 2. creating a list element for every row, 3. closing the list)
what I want to achieve it seems a little bit trickier.

My idea was to use underscorejs `_.sortBy` method to reorganize the
year into a dictionary, to end up with something like this:

       '2009': [
         {'title': ' The Transformer -- Principles of Making Isotype
         {'title': ' Verbindingen/Jonctions 10, Tracks in Electr(on)ic
Fields', ...},
       '2012': [
         {'title': 'Tying the Story to Data: The graffiti Markup Field
Recorder Challenged, GML', ...},
         {'title': 'Inside Photoshop', ...},

  From there, I'd be able to loop through each key and append to my
output an HTML list. Unfortunately, I'm unable to import underscorejs,
seems like they have dropped support for commonjs. There are forks and
similar libraries that are supposed to work, but whatever I try, it
(see my question here:

So I'd like to know whether it is achievable in this way or another,
my direction is correct, how I can use underscorejs (or similar) in a

Thanks a lot,