Integrating with server-side (Rails) project?

1 view
Skip to first unread message

Marcelo Alvim

unread,
Apr 25, 2008, 5:20:06 PM4/25/08
to JavaScript Project Generator
Hey, guys.

Newjs is very cool, I'm just getting started with it. Useful tool.

One thing that I think would be nice, though, is the ability to test
your JS lib in another project, say, a Rails one. I'm thinking of
something like a route in Rails that would map something like "/
javascripts/mylib-0.0.1.js" to an action that would build the library
and return the complete distribution file.

Then I would be back to just saving the file and refreshing the
browser to test it out, though I see how my suggestion of building
everything in an action could get slow for larger libraries.

Any suggestions?

Thanks,
Marcelo.

Nic Williams

unread,
Apr 25, 2008, 5:26:03 PM4/25/08
to javascript-pro...@googlegroups.com
Perhaps inside your public/javascripts folder is where you run "newjs mylib"; then you do everything within this folder; thus the distribution would be in public/javascripts/mylib/dist/mylib.js

So then in your application layouts, you'd reference this file

<script src="/javascripts/mylib/dist/mylib.js">

Thoughts?
--
Dr Nic Williams
http://drnicacademy.com - Ruby/Rails training/dev around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
(skype) nicwilliams
(p) +61 412 002 126 / +61 7 3113 3033
(mail) PO Box 583 Ashgrove 4060 QLD Aus
Reply all
Reply to author
Forward
0 new messages