best way to use ERb in a JavaScript file?

Xavi Caballe wrote:

I am currently naming my JavaScript files with the extension .rhtml just to be able of using ERb in them ("If the template file has a +.rhtml+ extension then it uses a mixture of ERb (included in Ruby) and HTML", http://api.rubyonrails.com/classes/ActionView/Base.html ). Does anybody know of a better way?
I looked at RJS, but it doesn't seem the right solution here.

Not sure why you wouldn't use RJS, but I saw a blog posting about setting up a route and controller to to use ERb on .rcss files. The same technique should work for you:

http://blog.hasmanythrough.com/articles/2006/03/23/dirt-simple-rcss-templates