Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Generate CoffeeScript stub by default

  • Loading branch information...
commit 23aa7dacb559a8e2c578b641d615f7fb8cd7b900 1 parent 9f09aeb
@josh josh authored
View
6 railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js
@@ -1,6 +0,0 @@
-// Place your application-specific JavaScript functions and classes here
-// FIXME: Tell people how Sprockets and Coffe works
-//
-//= require jquery
-//= require jquery_ujs
-//= require_tree .
View
6 railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.coffee
@@ -0,0 +1,6 @@
+# Place your application-specific JavaScript functions and classes here
+# FIXME: Tell people how Sprockets and CoffeeScript works
+#
+#= require jquery
+#= require jquery_ujs
+#= require_tree .

12 comments on commit 23aa7da

@sandrods

Man, I didn't see that coming. SO cool!!

@trotter

CoffeeScript is neat... but should it really be the default for Rails?

@iain

Wouldn't make Node.js be a dependency or Rails?

@atrefz

@trotter It should. Why? Because Rails defines the new, the better way. And CoffeeScript is the absolute better way to write JS.

@coderifous

CoffeeScript is neat... but should it really be the default for Rails?

If you share the mindset that the Coffeescript language is superior to Javascript, then the answer is yes. Why would we want the default to be a language we believe is inferior? The same kind of argument applies to haml/sass, IMO.

If we want to write code in JS, we still can - just leave off the .coffee suffix from the filename.

The argument for not using it because it will "confuse noobs" doesn't seem very compelling to me. As long as it's made clear that you can still write regular JS, then it's moot. Holding the framework back based on a lowest-common-denominator argument would be a mistake.

@dhh
Owner

(BTW, the application.js file is no longer shipping with .coffee added for the simple reason that it'll have no code. But if coffee is available, we'll be generating JS stubs for new controllers (like helpers) with the coffee extension on).

@OhaiBBQ

@iain "The command-line version of coffee is available as a Node.js utility. The core compiler however, does not depend on Node."

@ptzn

Guys, are you really want to make Rails ugly fat monster with all this libraries (coffeescript, sass, haml maybe?) included by default? If yes why you move error_messages_for into plugin?

@jakemarsh

With all the similarities between CoffeeScript's syntax and ruby's syntax, this isn't too terribly surprising. I think it will be great, I'm looking forward to even deeper integration in the future.

@adambair

The argument for not using it because it will "confuse noobs" doesn't seem very compelling to me. As long as it's made clear that you can still write regular JS, then it's moot. Holding the framework back based on a lowest-common-denominator argument would be a mistake.

Seems reasonable; "noobs" are better served by up-to-date documentation and tutorials in my opinion.

@nuttycom

CoffeeScript? Weak sauce, you guys should be using https://github.com/spencertipping/caterwaul instead. :)

Please sign in to comment.
Something went wrong with that request. Please try again.