More info on why it is important can be found here: http://developer.yahoo.com/performance/rules.html#js_bottom
👍, but can you keep proper indentation?
After discussing this with some of the core team members I think that's not something that should be the default. The problem is such approach will work only for 100% unobtrusive UJS sites. While this is often the case, it may be confusing for beginners.
This thing alone will not usually have huge impact on page load time, so probably it's better to leave it to advanced developers that know what they're doing.
But doing this change, we would be promoting "best practices" which would be cool. And just to mention; Clean, Semantic and accessible HTML with cached, external JS and CSS trumps inline-stuff every day.
PS: this is my humble opinion, please feel free to disagree
👍 I think we should promote what we think is the best way
I would, however remove the html comment.
This breaks inline js in surprising ways. It's easy to move back to the head, but only after serious head/desk injury.
Conversely, it's easy to move to the bottom. We could include a comment on the bottom, instead, mentioning that you can move your scripts there as long as you're careful, well-informed, and 100% ujs.
@gaurish please make changes as @jeremy suggested and squash commits into one commit.
no need in temporary array in number_to_phone helper
with rails templates, we promote "Best practices" in web development.
Hence a comment has been added encouraging developers to move js at bottom of the page
Changes made & squashed changes into commit but for some reason previous unrelated commit is showing up.
Yes, comment might be a good place to start without breaking compat
@gaurish New PR?
// My JS code here
<% end %>
<% end %>
Let's enforce a default name for the placeholder that most people will use. This way it becomes obvious and people don't have to google for answers like I did.