RubyFlow The Ruby and Rails community linklog

Finally, A Sexy Way To Organize JS Files Using Rails Asset Pipeline

It is great that Rails asset pipeline compress all our js files into one big js file. But sometimes it introduces code conflicts and shits because what we really want is specific js code per page!

Check out Paloma and start organizing your JS files the sexy way. :)

Comments

Any reason for the generator having unusual syntax? rails g paloma:add users/new

Why not use the rails controller generator syntax for this? rails g paloma users new

Othen than that, nice gem. I can myself using it some day.

Nice.

I really like the parameter passing part - all the existing methods of passing server side values to your JavaScript never seemed that clean to me. Being able to declare it in the controller like that is great.

One comment - calling it a “js_callback” in the controller doesn’t sit right - it’s not exactly what I think of when I think callback. It’s just the client side part of your action…maybe call it just “js” or even “javascript”?

We use BackboneJS and have a couple lines of JavaScript code in each view to set up the right backbone view - something like this can clean it up nicely.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in