Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A2C3F9BB9 for ; Thu, 16 Feb 2012 07:57:18 +0000 (UTC) Received: (qmail 46483 invoked by uid 500); 16 Feb 2012 07:57:17 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 46413 invoked by uid 500); 16 Feb 2012 07:57:16 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 46405 invoked by uid 99); 16 Feb 2012 07:57:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2012 07:57:16 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of john.tigernassau@gmail.com designates 209.85.214.180 as permitted sender) Received: from [209.85.214.180] (HELO mail-tul01m020-f180.google.com) (209.85.214.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2012 07:57:08 +0000 Received: by obbuo19 with SMTP id uo19so3475762obb.11 for ; Wed, 15 Feb 2012 23:56:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=njg89hXdM4Hq3xLW2QOTcPc9pfPaKcfaZ7AjK8MAMQA=; b=WqN5YMLw52jKeK45sa+ylacBcbKpnYOjhRw1aOUEBTi4xLrzYkGIYZIGoN+o+7kFps rkFNjqs4ZO2IOnEeldYV/eazLqX0Zt6JfqdRc7Hxx0BDFDRGIvAscDWVjgwm4lJNP8x/ 9wQQt4bLCHOmIGoR/U1xul6i4M0vrU+mDWoMc= Received: by 10.60.0.195 with SMTP id 3mr607806oeg.2.1329379008100; Wed, 15 Feb 2012 23:56:48 -0800 (PST) Received: from [172.16.112.79] ([206.54.113.250]) by mx.google.com with ESMTPS id p7sm1463961oep.10.2012.02.15.23.56.44 (version=SSLv3 cipher=OTHER); Wed, 15 Feb 2012 23:56:46 -0800 (PST) Message-ID: <4F3CB68F.2050004@gmail.com> Date: Thu, 16 Feb 2012 00:55:59 -0700 From: "john.tiger" User-Agent: Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: user@couchdb.apache.org Subject: Re: using mustache in couchapp References: <4F3C554F.4070900@gmail.com> <1E88C225-E1C9-4A68-B44C-948E45940400@calftrail.com> In-Reply-To: <1E88C225-E1C9-4A68-B44C-948E45940400@calftrail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 02/16/2012 12:08 AM, Nathan Vander Wilt wrote: > On Feb 15, 2012, at 5:01 PM, john.tiger wrote: >> assuming my app.js and mustache.js are in the same attachments folder - when I've used: >> var Mustache = require('mustache'); >> => require not found >> >> do I have to include require.js as well ? > If you want to use JavaScript on the server side, you'll need to store it as a *property* on your design doc. So in a "lib" folder (outside of _attachments) with the 'couchapp' it will get included like: > > > couchapp folder > _id file > |_ _attachments folder > |_ ...clientside media... > |_ lib folder > |_ mustache.js > > <----> > > {_id:"", _attachments: {...}, lib:{mustache:""}} > > Then you would use it in a _show/_list/_update function with `var Mustache = require('lib/mustache')`. When I do need a library both server and clientside with 'couchapp', I tend to symlink it so it appears in both _attachments and other properties. > > > hope this helps, yes, it does - thks.