You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by erich oliphant <er...@gmail.com> on 2010/05/07 14:43:19 UTC

including external javascript libs

Hi,
I am trying to figure out the best way to include js libs in my couch
show,view,etc functions.  I just realized the the examples in the couch book
with the !code and !json macros are specific to CouchApp.  For instance I
ned to parse some ISO 8601 dates, and have a little date.js script that I'd
like to include in my functions.

Thanks In Advance

-- 
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

Re: including external javascript libs

Posted by J Chris Anderson <jc...@gmail.com>.
On May 7, 2010, at 1:16 PM, Ryan Ramage wrote:

> Is there a way to 'install' javascript files on the server so they
> would be available to map/reduce functions? Can they be added to the
> directory /share/couchdb/server ?
> 

This doesn't work, because then if your application is replicated to a "standard" couch, it breaks. The robust solution is to include all your JavaScript code in the design document.

Chris

> http://documentcloud.github.com/underscore/
> 
> Would be a handy library to have around.
> 
> Ryan
> 
> 
> On Sat, May 8, 2010 at 3:12 AM, erich oliphant <er...@gmail.com> wrote:
>> Ok thanks for the clarification
>> 
>> On Fri, May 7, 2010 at 9:07 AM, Sebastian Cohnen <
>> sebastiancohnen@googlemail.com> wrote:
>> 
>>> the !code macro simply replaces itself with the content of the target. if
>>> you don't want to use couchapp, you have to insert your code yourself.
>>> "loading" from an external resource is not allowed since views wouldn't be
>>> side effect free (couch would not notice if the external code has been
>>> changed).
>>> 
>>> For loading code in show, list, update and validation functions you can use
>>> CommonJS-style modules (see
>>> http://wiki.apache.org/couchdb/CommonJS_Modules )
>>> 
>>> On 07.05.2010, at 14:43, erich oliphant wrote:
>>> 
>>>> Hi,
>>>> I am trying to figure out the best way to include js libs in my couch
>>>> show,view,etc functions.  I just realized the the examples in the couch
>>> book
>>>> with the !code and !json macros are specific to CouchApp.  For instance I
>>>> ned to parse some ISO 8601 dates, and have a little date.js script that
>>> I'd
>>>> like to include in my functions.
>>>> 
>>>> Thanks In Advance
>>>> 
>>>> --
>>>> Erich Oliphant
>>>> 
>>>> "There are, in fact, two things, science and opinion, the former begets
>>>> knowledge, the latter ignorance"
>>>> -- Hippocrates of Cos
>>> 
>>> 
>> 
>> 
>> --
>> Erich Oliphant
>> 
>> "There are, in fact, two things, science and opinion, the former begets
>> knowledge, the latter ignorance"
>> -- Hippocrates of Cos
>> 


Re: including external javascript libs

Posted by Ryan Ramage <ry...@gmail.com>.
Is there a way to 'install' javascript files on the server so they
would be available to map/reduce functions? Can they be added to the
directory /share/couchdb/server ?

http://documentcloud.github.com/underscore/

Would be a handy library to have around.

Ryan


On Sat, May 8, 2010 at 3:12 AM, erich oliphant <er...@gmail.com> wrote:
> Ok thanks for the clarification
>
> On Fri, May 7, 2010 at 9:07 AM, Sebastian Cohnen <
> sebastiancohnen@googlemail.com> wrote:
>
>> the !code macro simply replaces itself with the content of the target. if
>> you don't want to use couchapp, you have to insert your code yourself.
>> "loading" from an external resource is not allowed since views wouldn't be
>> side effect free (couch would not notice if the external code has been
>> changed).
>>
>> For loading code in show, list, update and validation functions you can use
>> CommonJS-style modules (see
>> http://wiki.apache.org/couchdb/CommonJS_Modules )
>>
>> On 07.05.2010, at 14:43, erich oliphant wrote:
>>
>> > Hi,
>> > I am trying to figure out the best way to include js libs in my couch
>> > show,view,etc functions.  I just realized the the examples in the couch
>> book
>> > with the !code and !json macros are specific to CouchApp.  For instance I
>> > ned to parse some ISO 8601 dates, and have a little date.js script that
>> I'd
>> > like to include in my functions.
>> >
>> > Thanks In Advance
>> >
>> > --
>> > Erich Oliphant
>> >
>> > "There are, in fact, two things, science and opinion, the former begets
>> > knowledge, the latter ignorance"
>> > -- Hippocrates of Cos
>>
>>
>
>
> --
> Erich Oliphant
>
> "There are, in fact, two things, science and opinion, the former begets
> knowledge, the latter ignorance"
> -- Hippocrates of Cos
>

Re: including external javascript libs

Posted by erich oliphant <er...@gmail.com>.
Ok thanks for the clarification

On Fri, May 7, 2010 at 9:07 AM, Sebastian Cohnen <
sebastiancohnen@googlemail.com> wrote:

> the !code macro simply replaces itself with the content of the target. if
> you don't want to use couchapp, you have to insert your code yourself.
> "loading" from an external resource is not allowed since views wouldn't be
> side effect free (couch would not notice if the external code has been
> changed).
>
> For loading code in show, list, update and validation functions you can use
> CommonJS-style modules (see
> http://wiki.apache.org/couchdb/CommonJS_Modules )
>
> On 07.05.2010, at 14:43, erich oliphant wrote:
>
> > Hi,
> > I am trying to figure out the best way to include js libs in my couch
> > show,view,etc functions.  I just realized the the examples in the couch
> book
> > with the !code and !json macros are specific to CouchApp.  For instance I
> > ned to parse some ISO 8601 dates, and have a little date.js script that
> I'd
> > like to include in my functions.
> >
> > Thanks In Advance
> >
> > --
> > Erich Oliphant
> >
> > "There are, in fact, two things, science and opinion, the former begets
> > knowledge, the latter ignorance"
> > -- Hippocrates of Cos
>
>


-- 
Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

Re: including external javascript libs

Posted by Sebastian Cohnen <se...@googlemail.com>.
the !code macro simply replaces itself with the content of the target. if you don't want to use couchapp, you have to insert your code yourself. "loading" from an external resource is not allowed since views wouldn't be side effect free (couch would not notice if the external code has been changed).

For loading code in show, list, update and validation functions you can use CommonJS-style modules (see http://wiki.apache.org/couchdb/CommonJS_Modules )

On 07.05.2010, at 14:43, erich oliphant wrote:

> Hi,
> I am trying to figure out the best way to include js libs in my couch
> show,view,etc functions.  I just realized the the examples in the couch book
> with the !code and !json macros are specific to CouchApp.  For instance I
> ned to parse some ISO 8601 dates, and have a little date.js script that I'd
> like to include in my functions.
> 
> Thanks In Advance
> 
> -- 
> Erich Oliphant
> 
> "There are, in fact, two things, science and opinion, the former begets
> knowledge, the latter ignorance"
> -- Hippocrates of Cos