I would be in favor of simply removing require_tree . from the default application.js file.
While I generally stick with the single javascript file for most of a rails project (as described by Jason), I find that sometimes there is one or two pages that need a very different set of javascripts. The problem that I have run in to with require_tree ., is that it becomes impossible to *not* require a file. In any case, I think it is better to encourage requiring files explicitly. -Amiel On Sat, Nov 1, 2014 at 5:59 PM, Austin Story <lonnieast...@gmail.com> wrote: > I think on a even more high level scale that we should start working > towards an opinionated rails way of handling Javascript frameworks; whether > that is either embracing one of the current ones or creating a new one > based on what works best with rails. > > The javascipt front end framework is still in it's growing stage, but it > does appear that it is the way the web is moving. > > At a minimum, would be great if as a community we start creating boiler > plate with that will allow people to easily integrate the 2 way binding of > model data the way that ember/angular do. > > > > On Friday, October 31, 2014 12:07:04 PM UTC-5, Brian Underwood wrote: >> >> I posted an issue about this ( https://github.com/rails/ >> rails/issues/17457#issuecomment-61292491 ) but I'll copy/paste here for >> discussion convenience: >> >> >> I feel like I'm the boy telling the emperor he has no clothes, but here >> goes... >> >> Every large rails project that I've worked on has had it's application >> javascript grow and grow because everybody leaves 'require_tree .' in >> application.js. Personally I hate it and remove it whenever I can (it's >> harder on legacy projects), but we should be loading javascript in a saner, >> more modular way. >> >> Very often I automagically include javascript files for controllers and >> actions if they exist. Here's an example of a helper that I've recently >> written (it's not neccessarily pretty, but you get the idea: >> >> def action_and_controller_javascript_include_tag >> capture do >> concat javascript_include_tag controller_name if >> Rails.root.join("app/assets/javascripts/#{controller_name}.coffee").exist? >> concat javascript_include_tag "#{controller_name}/#{action_name}" if >> Rails.root.join("app/assets/javascripts/#{controller_name}/#{action_name}.coffee").exist? >> end >> end >> >> I'd be fine if that were a gem, though rails already generates controller >> js files so it might make sense still. >> >> But seriously, can we please encourage not loading all of the javascript >> for the entire application? >> > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.