This project is archived and is in readonly mode.

#1786 ✓wontfix
Nathaniel Bibler

Minify packaged javascript libraries

Reported by Nathaniel Bibler | January 20th, 2009 @ 08:38 PM | in 2.x

The packaged JavaScript libraries - Prototype and - which are currently bundled with Rails are provided in their full, uncompressed, "development" versions:

  • controls.js (34716B)
  • dragdrop.js (31103B)
  • effects.js (38675B)
  • prototype.js (129738B)

(4 JS files weighing in at 234kB, as of Rails 2.2.2, Prototype

Using the freely available Yahoo! YUI Compressor with its default settings, the same 4 files become:

  • controls.js (21542B)
  • dragdrop.js (19256B)
  • effects.js (24677B)
  • prototype.js (74956B)

(4 JS files weighing in at 140kB)

That's about a 40% reduction in file size with supposedly no changes to functionality.

I realize that applications should probably ultimately be moving toward hosted libraries (using Google AJAX Libraries API, for example), but as long as the Rails framework is bundling libraries, shouldn't we try to lessen their impact as much as possible? Further, I'd argue that the uncompressed versions of those libraries are not necessary to provide with the Rails framework at all, as we HIGHLY encourage people to not modify those files directly. In fact, each new release of Rails seems to overwrite those files with the latest JS framework version, so we instead endorse using a application.js to add any custom functionality that may be required.

This seems like a relatively simple change that has a large, positive application performance impact.


Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>