# Javascript template, extension naming?

**URL:** <https://www.ruby-forum.com/t/javascript-template-extension-naming/177037>\
**Category:** Rails\
**Created:** [October 10, 2009, 6:55am UTC](https://www.ruby-forum.com/t/javascript-template-extension-naming/177037 "2009-10-10T06:55:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teedub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f475e1/32.png) [@Teedub](https://www.ruby-forum.com/u/Teedub)\
**Post date:** [October 10, 2009, 6:55am UTC](https://www.ruby-forum.com/t/javascript-template-extension-naming/177037/1 "2009-10-10T06:55:19Z")

</div>

It seems that I have a choice of  
blah.js  
blah.rjs  
blah.js.rjs  
and blah.js.erb  
plus I guess blah.rjs.erb (maybe)

I know that this is somewhat version dependent.  
Which is the “bestest”? and is there a difference.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Teedub](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f475e1/32.png) [@Teedub](https://www.ruby-forum.com/u/Teedub)\
**Post date:** [October 10, 2009, 10:30am UTC](https://www.ruby-forum.com/t/javascript-template-extension-naming/177037/2 "2009-10-10T10:30:10Z")

</div>

Teedub wrote:

> It seems that I have a choice of  
> blah.js  
> blah.rjs  
> blah.js.rjs  
> and blah.js.erb  
> plus I guess blah.rjs.erb (maybe)
> 
> I know that this is somewhat version dependent.  
> Which is the “bestest”? and is there a difference.

Remember, the template naming format is:  
action.type.renderer

So for blah.html.erb, Rails will use the ERb renderer and serve the  
result as HTML. Likewise, for blah.js.rjs , Rails will use the RJS  
renderer and serve the result as JavaScript. blah.js would be a plain  
JavaScript file that doesn’t get processed by Rails, and blah.rjs is the  
deprecated Rails 1.x way of naming blah.js.rjs. The remaining  
combinations are left as an exercise to the student. 🙂

> Thanks in advance.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
