How to build an array of paths to installed JamJS libraries?

40 views
Skip to first unread message

Dylan Hassinger

unread,
Apr 16, 2013, 11:01:58 AM4/16/13
to ja...@googlegroups.com
Hi everybody -

I saw the message from a couple months back, encouraging folks to integrate Jam into other frameworks. I would like to integrate it into Sails.js, a new framework that is pretty slick. But I'm in a little over my head.

>From my outside view, it seems like Jam does 2 things:
  • automatically installs frontend packages
  • combines those packages and inserts them via RequireJS
For Sails integration, I would like to use that first role - but bypass the second. Sails has its own Javascript bundler/handler, and if I can hand it an array of paths to JS files, then it could pull these files into its bundle.

Ideally, I'd be able to do something like this:

var libraries = jam.getLibs("/path/to/app");

This would then give me an array like so:

['/scripts/jquery/dist/jquery.min.js', '/scripts/mondernizr/modernizr.min.js', 'scripts/some_other_lib/script.js']

I tried experimenting with the ls method and some other methods inside Jam, but I got lost pretty quick. So figured I'd ask here if anybody has ideas on how I could do this - or if anybody would be interested in helping me add a method like this? I think it could be very useful for other folks trying to tie Jam into their stacks.   (RequireJS bundling is just not for everybody.)

Thanks for any suggestions!

dylan


--
dylan hassinger // @dylanized // dylanized.com

Caolan McMahon

unread,
Apr 17, 2013, 5:33:44 AM4/17/13
to ja...@googlegroups.com
Hi Dylan,

It's the RequireJS optimizer (r.js), that does the collecting of files
on compilation. Perhaps adding an option to exclude require.js from
the compiled output would allow you to simply include that in whatever
Sails creates?

Caolan
> --
> You received this message because you are subscribed to the Google Groups
> "jamjs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jamjs+un...@googlegroups.com.
> To post to this group, send an email to ja...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Dylan Hassinger

unread,
Apr 17, 2013, 12:41:30 PM4/17/13
to ja...@googlegroups.com
Hi Caolan, thanks for the response.  That option sounds like it would do the trick. 

Just to be clear, I don't need the assets compiled together or minified at all.  I just need them downloaded and saved into a specified folder.

Let me know if I can help at all!  I really think this would help other framework authors tie in JamJS too. cheers
Reply all
Reply to author
Forward
0 new messages