<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Synthesis: New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails</title>
    <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>by Scott Becker</description>
    <item>
      <title>New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails</title>
      <description>&lt;p&gt;After reading Cal Henderson&amp;#8217;s article on Vitamin &lt;a href="www.thinkvitamin.com/features/webapps/serving-javascript-fast"&gt;Serving Javascript Fast&lt;/a&gt;  I was immediately inspired to create a plugin to easily facilitate this in Ruby on Rails. I whipped up most of it right then, and finally got around to polishing it up for release today.&lt;/p&gt;


	&lt;p&gt;Here you go: &lt;a href="http://synthesis.sbecker.net/pages/merge_js"&gt;Merge JS: Easily merge, compress, cache, and version your javascript with Ruby on Rails&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 03 Jun 2006 13:35:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:8c8e649b-95bb-4bf2-8457-f0d84065d6e5</guid>
      <author>sbecker</author>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails</link>
      <category>Ruby on Rails</category>
      <category>Web Development</category>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Rich Wertz</title>
      <description>&lt;p&gt;Another worthwhile enhancement may be to modify the asset helpers to allow for &amp;#8220;shorthand&amp;#8221; that loads multiple .js/.css files   
given the name/symbol of their associated parent, merged file as defined in the YAML.  An example is shown below.&lt;/p&gt;


	&lt;p&gt;This should format better&amp;#8230;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;Given the following snippet from the YAML file:

javascripts:
- base:
  - prototype
  - effects
  - controls
  - dragdrop
  - application
- secondary:
  - foo
  - bar

&amp;lt;%= javascript_include_merged :base %&amp;gt;
would result in the following markup being generated in non-merging environments:

  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/prototype.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/effects.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/controls.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/dragdrop.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/application.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;

It would follow that
&amp;lt;%= javascript_include_merged :secondary %&amp;gt;
would result in the following markup being generated in non-merging environments:

&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/foo.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot; src=&amp;quot;/javascripts/bar.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;

That type of shorthand would be preferable to the current method of specifying the files separately as follows:

&amp;lt;%= javascript_include_merged 'foo', 'bar' %&amp;gt;&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Tue, 20 Jun 2006 15:42:01 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:0290bbcd-e82a-4775-b6ff-306cc3df9cb0</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-277</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by assaf</title>
      <description>&lt;p&gt;I love this plugin. I wrote my own merge script, but this one squeeze a few more kilobytes out of my scripts.&lt;/p&gt;


	&lt;p&gt;The timestamped filename also works better than Rails 1.1 query string timestamps. Scripts that use query strings are not cached by Safari, so you lose a bit. Still, I don’t see a lot of Safari traffic so I decided to go with query strings.&lt;/p&gt;


	&lt;p&gt;I do have one recommendation. In the rake task, check if the javascripts directory contains .svn. If it does, do svn delete/add for each script, that way it only takes one svn commit to upload the merged script to the repository.&lt;/p&gt;</description>
      <pubDate>Sat, 10 Jun 2006 02:49:07 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:af6964af-e8dc-438a-83fe-e75cc6c73dc4</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-258</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Adam</title>
      <description>&lt;p&gt;For the CSS cleanups you might want to look at &lt;a href="http://www.issuetrackerproduct.com/Download/#slimmer"&gt;http://www.issuetrackerproduct.com/Download/#slimmer&lt;/a&gt; Slimmer. I&amp;#8217;m sure a conversion of the CSS porition of it to Ruby would be trivial.&lt;/p&gt;</description>
      <pubDate>Fri, 09 Jun 2006 01:20:59 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:25f75d4e-98cd-4985-874e-a054df88ba4b</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-253</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Chris</title>
      <description>&lt;p&gt;I too wasn&amp;#8217;t a big fan of the timestamps, so I went ahead and reworked the source a little to look for the highest subversion revision number of any of the scripts in a specific package.  The config can than look more like this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;--- 
source_map: 
- base_121: 
  - prototype
  - effects
  - event-selectors
- search_60
  -search&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This way the caching will occur per package, seems to be working well for me.  Could definatly be made more robust.  I&amp;#8217;ll go ahead and submit my changes to Scott&lt;/p&gt;</description>
      <pubDate>Thu, 08 Jun 2006 16:06:32 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:85431249-f1b7-4a0b-9abc-89ccc87553a9</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-252</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Scott Becker</title>
      <description>&lt;p&gt;Thats funny since it was working fine on windows for me. (No names with spaces, thats probably why.) I&amp;#8217;ll see about adding that, as long as it doesn&amp;#8217;t break it on other platforms.&lt;/p&gt;</description>
      <pubDate>Wed, 07 Jun 2006 06:53:17 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:6ff073fb-750e-484a-b210-b715cb07935e</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-251</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by SR</title>
      <description>&lt;p&gt;Great Plugin&lt;/p&gt;


	&lt;p&gt;However, to get this working on Windows, I had to edit the line in the file that executes ruby to include quote marks around the file paths (including the one to jsmin.rb). I also added spaces between the &amp;lt; and &amp;gt;. Could this get fixed in the main version?&lt;/p&gt;


	&lt;p&gt;(The problem is due to the fact if your Rails Root has a folder with a space in the name (like &amp;#8220;Documents and Settings&amp;#8221;) it gets confused.)&lt;/p&gt;</description>
      <pubDate>Tue, 06 Jun 2006 18:47:20 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:6ba3985a-cf98-42c9-890d-db65e57d7997</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-250</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Scott Becker</title>
      <description>&lt;p&gt;Yes, I have an eye towards making this work for CSS assets too. And probably change the name to something like MergeAssets. :)&lt;/p&gt;


	&lt;p&gt;As far as the timestamps issue, I like having one solution that works for everyone. Why ignore  the others?&lt;/p&gt;</description>
      <pubDate>Mon, 05 Jun 2006 13:24:15 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:8b1a0678-b367-497d-a80b-e1f3dd4db6fe</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-248</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Chris Williams</title>
      <description>&lt;p&gt;This is great work &amp;#8211; aiming to create what Flickr uses in their deployments but making it easier for rails.&lt;/p&gt;


	&lt;p&gt;I think the next biggest gains would come in merging and compressing the stylesheets as well, as Tim mentioned in my entry&amp;#8217;s comment.  I know there&amp;#8217;s quite a few CSS compressors on the web, I wonder if there&amp;#8217;s any we could port (or if someone&amp;#8217;s already done this).&lt;/p&gt;


	&lt;p&gt;I agree with Tim that the timestamping via query params isn&amp;#8217;t such a huige issue becaise Firefox and IE don&amp;#8217;t actually follow spec and it&amp;#8217;ll work for them, but very high traffic sites or sites where the average users come from Mac owners or mobile phones should definitely be aware of the issues.&lt;/p&gt;</description>
      <pubDate>Mon, 05 Jun 2006 09:26:35 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:d6e6ccd7-1602-4856-994b-4435eb43dfbd</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-247</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Scott Becker</title>
      <description>&lt;p&gt;It&amp;#8217;s released under the MIT license. I&amp;#8217;ll add that text to the Readme file. Feel free to rip it up! It&amp;#8217;d be great if you could send any improvements you make back my way so I could include them.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m going to add a few things more things I&amp;#8217;ve thought of to improve it&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Sun, 04 Jun 2006 10:31:11 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:de5282ca-742f-4dbb-9f23-0d2cc1aee29c</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-230</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Tim Lucas</title>
      <description>&lt;p&gt;and in case anybody wants to rip it apart and improve/modify it, what license is it released under?&lt;/p&gt;</description>
      <pubDate>Sun, 04 Jun 2006 05:58:40 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:75a9fc1a-e3be-4114-b5f3-900931ae085d</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-229</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Tim Lucas</title>
      <description>&lt;p&gt;Actually I don&amp;#8217;t mind your timestamp-on-URL approach, but more intelligent timestamping would be better as each new deployment would require a redownload of all assets, even if the file hasn&amp;#8217;t itself changed.&lt;/p&gt;</description>
      <pubDate>Sun, 04 Jun 2006 05:33:02 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:95dce663-8697-4686-9e02-046cb715e197</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-228</link>
    </item>
    <item>
      <title>"New Plugin: MergeJS - Easily merge, compress, cache, and version your javascript with Ruby on Rails" by Tim Lucas</title>
      <description>&lt;p&gt;Great work you&amp;#8217;ve done on the plugin, but I&amp;#8217;m not sure I like the idea of the &amp;#8220;current version.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;d much prefer to keep this out of the plugin and just have it deal with merging. You could then let rails use the default asset timestamping or your own that&amp;#8217;s based on individual (as opposed to app-wide) asset revisions.&lt;/p&gt;


	&lt;p&gt;I don&amp;#8217;t think you need to worry too much about the whole &amp;#8220;not all browsers will cache javascript files with query string parameters.&amp;#8221;&lt;/p&gt;</description>
      <pubDate>Sun, 04 Jun 2006 05:18:07 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:06e8928c-a5eb-4f30-b258-f4dc0fadbe8a</guid>
      <link>http://synthesis.sbecker.net/articles/2006/06/03/mergejs-easily-merge-compress-cache-and-version-your-javascript-with-ruby-on-rails#comment-227</link>
    </item>
  </channel>
</rss>
