Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version bump to 0.4.2

  • Loading branch information...
commit d3370f941eefb4f88ab72ba77e3f431518ad368a 1 parent d003a6c
@rondevera rondevera authored
View
1  HISTORY
@@ -1,5 +1,6 @@
= HISTORY
+== Version 0.4.2 (2011-08-08)
* FIX: Changed Capistrano task to minify assets inside latest release path,
not previous release path. (Thanks, sauliusg[https://github.com/sauliusg]!)
* FIX: Fixed deprecation warnings when running Rake tasks. (Thanks,
View
2  VERSION.yml
@@ -2,4 +2,4 @@
:major: 0
:build:
:minor: 4
-:patch: 1
+:patch: 2
View
4 asset_hat.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{asset_hat}
- s.version = "0.4.1"
+ s.version = "0.4.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ron DeVera", "Mint Digital"]
- s.date = %q{2011-05-19}
+ s.date = %q{2011-08-08}
s.description = %q{Load CSS and JS faster. Minifies, bundles, and optimizes CSS/JS assets ahead of time (e.g., on deploy), not at runtime. Loads popular third-party JS (like jQuery, YUI, and Dojo) from localhost in development, and auto-switches to Google's CDN in production. Lets you switch on LABjs mode to load more scripts in parallel. Can rewrite stylesheets to use CDN hosts (not just your web server) and cache-busting hashes for updated images.}
s.email = %q{hello@rondevera.com}
s.extra_rdoc_files = [
View
2  doc/classes/AssetHat/JS/Vendors.html
@@ -186,7 +186,7 @@ <h1 class='name'>
HTTPS. Defaults to false.
</dd>
- <dt>version</dt><dd>The vendor version, e.g., &#8216;1.5.0&#8217; for jQuery 1.5. By default,
+ <dt>version</dt><dd>The vendor version, e.g., &#8216;1.6.0&#8217; for jQuery 1.6. By default,
each vendor version is taken from <tt>config/assets.yml</tt>; use this
option to override the configuration.
View
8 doc/classes/AssetHatHelper.html
@@ -85,7 +85,7 @@ <h1 class='name'>
<a class='source-toggle' href='#' onclick="toggleCode('M000032-source'); return false">
[show source]
</a>
- <pre id='M000032-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 368</span>&#x000A;368: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">asset_path</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">source</span>)&#x000A;369: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>&#x000A;370: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-identifier">stylesheet_path</span>(<span class="ruby-identifier">source</span>)&#x000A;371: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-identifier">javascript_path</span>(<span class="ruby-identifier">source</span>)&#x000A;372: <span class="ruby-keyword kw">else</span>&#x000A;373: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{Unknown type &quot;#{type}&quot;; should be one of: #{TYPES.join(', ')}.}</span>&#x000A;374: <span class="ruby-keyword kw">end</span>&#x000A;375: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000032-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 363</span>&#x000A;363: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">asset_path</span>(<span class="ruby-identifier">type</span>, <span class="ruby-identifier">source</span>)&#x000A;364: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_sym</span>&#x000A;365: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:css</span> ; <span class="ruby-identifier">stylesheet_path</span>(<span class="ruby-identifier">source</span>)&#x000A;366: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:js</span> ; <span class="ruby-identifier">javascript_path</span>(<span class="ruby-identifier">source</span>)&#x000A;367: <span class="ruby-keyword kw">else</span>&#x000A;368: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{&#x000A;369: Unknown type &quot;#{type}&quot;; should be one of:&#x000A;370: #{AssetHat::TYPES.join(', ')}.&#x000A;371: }</span>.<span class="ruby-identifier">squish!</span>&#x000A;372: <span class="ruby-keyword kw">end</span>&#x000A;373: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000030'>
@@ -148,7 +148,7 @@ <h1 class='name'>
<a class='source-toggle' href='#' onclick="toggleCode('M000030-source'); return false">
[show source]
</a>
- <pre id='M000030-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 159</span>&#x000A;159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_css</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;160: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">blank?</span>&#x000A;161: &#x000A;162: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span> <span class="ruby-operator">||=</span> {}&#x000A;163: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>] <span class="ruby-operator">||=</span> {}&#x000A;164: &#x000A;165: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>&#x000A;166: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys!</span>.<span class="ruby-identifier">reverse_merge!</span>(&#x000A;167: <span class="ruby-identifier">:media</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'screen,projection'</span>, <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span>)&#x000A;168: <span class="ruby-identifier">cache_key</span> = (<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">options</span>]).<span class="ruby-identifier">inspect</span>&#x000A;169: &#x000A;170: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">cache?</span> <span class="ruby-operator">||</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>][<span class="ruby-identifier">cache_key</span>].<span class="ruby-identifier">blank?</span>&#x000A;171: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;172: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>] <span class="ruby-operator">&amp;&amp;=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">ssl_asset_host_differs?</span>&#x000A;173: <span class="ruby-identifier">html</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>][<span class="ruby-identifier">cache_key</span>] =&#x000A;174: <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:css</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">options</span>]))&#x000A;175: <span class="ruby-keyword kw">end</span>&#x000A;176: &#x000A;177: <span class="ruby-identifier">html</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>][<span class="ruby-identifier">cache_key</span>]&#x000A;178: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:html_safe</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">html</span>.<span class="ruby-identifier">html_safe</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">html</span>&#x000A;179: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000030-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 159</span>&#x000A;159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_css</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;160: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">blank?</span>&#x000A;161: &#x000A;162: <span class="ruby-identifier">initialize_html_cache</span> <span class="ruby-identifier">:css</span>&#x000A;163: &#x000A;164: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">args</span>,&#x000A;165: <span class="ruby-identifier">:media</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">'screen,projection'</span>,&#x000A;166: <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span>&#x000A;167: )&#x000A;168: <span class="ruby-identifier">cache_key</span> = <span class="ruby-identifier">setup_cache_key</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">options</span>)&#x000A;169: &#x000A;170: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">asset_cached?</span>(<span class="ruby-identifier">:css</span>, <span class="ruby-identifier">cache_key</span>)&#x000A;171: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;172: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:ssl</span>] <span class="ruby-operator">&amp;&amp;=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">ssl_asset_host_differs?</span>&#x000A;173: <span class="ruby-identifier">html</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>][<span class="ruby-identifier">cache_key</span>] =&#x000A;174: <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:css</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">options</span>]))&#x000A;175: <span class="ruby-keyword kw">end</span>&#x000A;176: &#x000A;177: <span class="ruby-identifier">html</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:css</span>][<span class="ruby-identifier">cache_key</span>]&#x000A;178: <span class="ruby-identifier">make_html_safe</span> <span class="ruby-identifier">html</span>&#x000A;179: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
<div class='method public-instance' id='method-M000031'>
@@ -174,7 +174,7 @@ <h1 class='name'>
<p>
Include jQuery:
</p>
- <pre># Development/test environment:&#x000A;include_js :jquery&#x000A;=&gt; &lt;script src=&quot;/javascripts/jquery-VERSION.min.js&quot; ...&gt;&lt;/script&gt;&#x000A;&#x000A;# Staging/production environment:&#x000A;include_js :jquery&#x000A;=&gt; &lt;script src=&quot;http://ajax.googleapis.com/.../jquery.min.js&quot; ...&gt;&lt;/script&gt;&#x000A; # Set jQuery versions either in `config/assets.yml`, or by using&#x000A; # `include_js :jquery, :version =&gt; '1.6.0'`.</pre>
+ <pre># Development/test environment:&#x000A;include_js :jquery&#x000A;=&gt; &lt;script src=&quot;/javascripts/jquery-VERSION.min.js&quot; ...&gt;&lt;/script&gt;&#x000A;&#x000A;# Staging/production environment:&#x000A;include_js :jquery&#x000A;=&gt; &lt;script src=&quot;http://ajax.googleapis.com/.../jquery.min.js&quot; ...&gt;&lt;/script&gt;&#x000A; # Set jQuery versions either in `config/assets.yml`, or by using&#x000A; # `include_js :jquery, :version =&gt; '1.6.1'`.</pre>
<p>
Include a bundle of JS files (i.e., a concatenated set of files; configure
in <tt>config/assets.yml</tt>):
@@ -224,7 +224,7 @@ <h1 class='name'>
<a class='source-toggle' href='#' onclick="toggleCode('M000031-source'); return false">
[show source]
</a>
- <pre id='M000031-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 295</span>&#x000A;295: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_js</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;296: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">blank?</span>&#x000A;297: &#x000A;298: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span> <span class="ruby-operator">||=</span> {}&#x000A;299: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>] <span class="ruby-operator">||=</span> {}&#x000A;300: &#x000A;301: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>&#x000A;302: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">symbolize_keys!</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span>)&#x000A;303: <span class="ruby-identifier">cache_key</span> = (<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">options</span>]).<span class="ruby-identifier">inspect</span>&#x000A;304: &#x000A;305: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">cache?</span> <span class="ruby-operator">||</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>][<span class="ruby-identifier">cache_key</span>].<span class="ruby-identifier">blank?</span>&#x000A;306: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;307: &#x000A;308: <span class="ruby-identifier">htmls</span> = []&#x000A;309: <span class="ruby-identifier">include_assets_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">except</span>(<span class="ruby-identifier">:ssl</span>, <span class="ruby-identifier">:version</span>)&#x000A;310: <span class="ruby-identifier">loader</span> = <span class="ruby-keyword kw">nil</span>&#x000A;311: &#x000A;312: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:loader</span>].<span class="ruby-identifier">present?</span>&#x000A;313: <span class="ruby-identifier">loader</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:loader</span>)&#x000A;314: <span class="ruby-identifier">include_assets_options</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">:only_url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)&#x000A;315: <span class="ruby-keyword kw">end</span>&#x000A;316: &#x000A;317: <span class="ruby-comment cmt"># Get vendor HTML/URLs</span>&#x000A;318: <span class="ruby-identifier">included_vendors</span> = (<span class="ruby-identifier">args</span> <span class="ruby-operator">&amp;</span> <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">VENDORS</span>)&#x000A;319: &#x000A;320: <span class="ruby-comment cmt"># Add HTML inclusions for vendors</span>&#x000A;321: <span class="ruby-identifier">included_vendors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">vendor</span><span class="ruby-operator">|</span>&#x000A;322: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">vendor</span>&#x000A;323: <span class="ruby-identifier">src</span> = <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">Vendors</span>.<span class="ruby-identifier">source_for</span>(&#x000A;324: <span class="ruby-identifier">vendor</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">:ssl</span>, <span class="ruby-identifier">:version</span>))&#x000A;325: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:js</span>, <span class="ruby-identifier">src</span>,&#x000A;326: <span class="ruby-identifier">include_assets_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:cache</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>).&#x000A;327: <span class="ruby-identifier">except</span>(<span class="ruby-identifier">:bundle</span>, <span class="ruby-identifier">:bundles</span>))&#x000A;328: <span class="ruby-keyword kw">end</span>&#x000A;329: &#x000A;330: <span class="ruby-comment cmt"># Get non-vendor HTML/URLs</span>&#x000A;331: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:js</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">include_assets_options</span>]))&#x000A;332: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">reject!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:blank?</span>)&#x000A;333: &#x000A;334: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loader</span>&#x000A;335: <span class="ruby-comment cmt"># `htmls` actually contains URLs; convert to an HTML/JS block</span>&#x000A;336: <span class="ruby-identifier">urls</span> = <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">flatten</span>&#x000A;337: <span class="ruby-identifier">htmls</span> = []&#x000A;338: &#x000A;339: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">loader</span>&#x000A;340: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:lab_js</span>&#x000A;341: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_js</span>(<span class="ruby-identifier">:lab_js</span>)&#x000A;342: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&lt;script type=&quot;text/javascript&quot;&gt;'</span>&#x000A;343: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">Vendors</span>.<span class="ruby-identifier">loader_js</span>(<span class="ruby-identifier">:lab_js</span>, <span class="ruby-identifier">:urls</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">urls</span>)&#x000A;344: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&lt;/script&gt;'</span>&#x000A;345: <span class="ruby-keyword kw">end</span>&#x000A;346: <span class="ruby-keyword kw">end</span>&#x000A;347: &#x000A;348: <span class="ruby-comment cmt"># Convert to a URL (string), array of URLs, or one long HTML string</span>&#x000A;349: <span class="ruby-identifier">html</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only_url</span>]&#x000A;350: <span class="ruby-comment cmt"># Return one URL (string) or multiple (array of strings).</span>&#x000A;351: <span class="ruby-comment cmt"># Not actually HTML.</span>&#x000A;352: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">flatten!</span>&#x000A;353: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">htmls</span>&#x000A;354: <span class="ruby-keyword kw">else</span>&#x000A;355: <span class="ruby-comment cmt"># Return one long string of HTML</span>&#x000A;356: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>).<span class="ruby-identifier">strip</span>&#x000A;357: <span class="ruby-keyword kw">end</span>&#x000A;358: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>][<span class="ruby-identifier">cache_key</span>] = <span class="ruby-identifier">html</span>&#x000A;359: <span class="ruby-keyword kw">end</span>&#x000A;360: &#x000A;361: <span class="ruby-identifier">html</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>][<span class="ruby-identifier">cache_key</span>]&#x000A;362: <span class="ruby-identifier">html</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:html_safe</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">html</span>.<span class="ruby-identifier">html_safe</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">html</span>&#x000A;363: <span class="ruby-keyword kw">end</span></pre>
+ <pre id='M000031-source'> <span class="ruby-comment cmt"># File lib/asset_hat_helper.rb, line 295</span>&#x000A;295: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_js</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;296: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">blank?</span>&#x000A;297: &#x000A;298: <span class="ruby-identifier">initialize_html_cache</span> <span class="ruby-identifier">:js</span>&#x000A;299: &#x000A;300: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span>)&#x000A;301: <span class="ruby-identifier">cache_key</span> = <span class="ruby-identifier">setup_cache_key</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">options</span>)&#x000A;302: &#x000A;303: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">asset_cached?</span>(<span class="ruby-identifier">:js</span>, <span class="ruby-identifier">cache_key</span>)&#x000A;304: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;305: &#x000A;306: <span class="ruby-identifier">htmls</span> = []&#x000A;307: <span class="ruby-identifier">include_assets_options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">except</span>(<span class="ruby-identifier">:ssl</span>, <span class="ruby-identifier">:version</span>)&#x000A;308: &#x000A;309: <span class="ruby-identifier">loader</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:loader</span>)&#x000A;310: <span class="ruby-identifier">include_assets_options</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">:only_url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loader</span>&#x000A;311: &#x000A;312: <span class="ruby-comment cmt"># Get vendor HTML/URLs</span>&#x000A;313: <span class="ruby-identifier">included_vendors</span> = (<span class="ruby-identifier">args</span> <span class="ruby-operator">&amp;</span> <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">VENDORS</span>)&#x000A;314: &#x000A;315: <span class="ruby-comment cmt"># Add HTML inclusions for vendors</span>&#x000A;316: <span class="ruby-identifier">included_vendors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">vendor</span><span class="ruby-operator">|</span>&#x000A;317: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">vendor</span>&#x000A;318: <span class="ruby-identifier">src</span> = <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">Vendors</span>.<span class="ruby-identifier">source_for</span>(&#x000A;319: <span class="ruby-identifier">vendor</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">:ssl</span>, <span class="ruby-identifier">:version</span>))&#x000A;320: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:js</span>, <span class="ruby-identifier">src</span>,&#x000A;321: <span class="ruby-identifier">include_assets_options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:cache</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>).&#x000A;322: <span class="ruby-identifier">except</span>(<span class="ruby-identifier">:bundle</span>, <span class="ruby-identifier">:bundles</span>))&#x000A;323: <span class="ruby-keyword kw">end</span>&#x000A;324: &#x000A;325: <span class="ruby-comment cmt"># Get non-vendor HTML/URLs</span>&#x000A;326: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:js</span>, <span class="ruby-operator">*</span>(<span class="ruby-identifier">args</span> <span class="ruby-operator">+</span> [<span class="ruby-identifier">include_assets_options</span>]))&#x000A;327: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">reject!</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">:blank?</span>)&#x000A;328: &#x000A;329: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">loader</span>&#x000A;330: <span class="ruby-comment cmt"># `htmls` actually contains URLs; convert to an HTML/JS block</span>&#x000A;331: <span class="ruby-identifier">urls</span> = <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">flatten</span>&#x000A;332: <span class="ruby-identifier">htmls</span> = []&#x000A;333: &#x000A;334: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">loader</span>&#x000A;335: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:lab_js</span>&#x000A;336: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">include_js</span>(<span class="ruby-identifier">:lab_js</span>)&#x000A;337: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&lt;script type=&quot;text/javascript&quot;&gt;'</span>&#x000A;338: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">JS</span><span class="ruby-operator">::</span><span class="ruby-constant">Vendors</span>.<span class="ruby-identifier">loader_js</span>(<span class="ruby-identifier">:lab_js</span>, <span class="ruby-identifier">:urls</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">urls</span>)&#x000A;339: <span class="ruby-identifier">htmls</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'&lt;/script&gt;'</span>&#x000A;340: <span class="ruby-keyword kw">end</span>&#x000A;341: <span class="ruby-keyword kw">end</span>&#x000A;342: &#x000A;343: <span class="ruby-comment cmt"># Convert to a URL (string), array of URLs, or one long HTML string</span>&#x000A;344: <span class="ruby-identifier">html</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:only_url</span>]&#x000A;345: <span class="ruby-comment cmt"># Return one URL (string) or multiple (array of strings).</span>&#x000A;346: <span class="ruby-comment cmt"># Not actually HTML.</span>&#x000A;347: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">flatten!</span>&#x000A;348: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">htmls</span>&#x000A;349: <span class="ruby-keyword kw">else</span>&#x000A;350: <span class="ruby-comment cmt"># Return one long string of HTML</span>&#x000A;351: <span class="ruby-identifier">htmls</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>).<span class="ruby-identifier">strip</span>&#x000A;352: <span class="ruby-keyword kw">end</span>&#x000A;353: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>][<span class="ruby-identifier">cache_key</span>] = <span class="ruby-identifier">html</span>&#x000A;354: <span class="ruby-keyword kw">end</span>&#x000A;355: &#x000A;356: <span class="ruby-identifier">html</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span>[<span class="ruby-identifier">:js</span>][<span class="ruby-identifier">cache_key</span>]&#x000A;357: <span class="ruby-identifier">make_html_safe</span> <span class="ruby-identifier">html</span>&#x000A;358: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
View
2  doc/created.rid
@@ -1 +1 @@
-Wed, 01 Jun 2011 08:32:28 -0400
+Mon, 08 Aug 2011 14:30:15 -0400
View
14 doc/files/HISTORY.html
@@ -31,13 +31,25 @@
</div>
<div class='last-update'>
Last Update:
- <span class='datetime'>Fri May 06 18:12:52 -0400 2011</span>
+ <span class='datetime'>Mon Aug 08 13:47:59 -0400 2011</span>
</div>
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<h1><a href="HISTORY.html">HISTORY</a></h1>
+ <h2>Version 0.4.2 (2011-08-08)</h2>
+ <ul>
+ <li>FIX: Changed Capistrano task to minify assets inside latest release path,
+ not previous release path. (Thanks, <a
+ href="https://github.com/sauliusg">sauliusg</a>!)
+
+ </li>
+ <li>FIX: Fixed deprecation warnings when running Rake tasks. (Thanks, <a
+ href="https://github.com/jsonperl">jsonperl</a>!)
+
+ </li>
+ </ul>
<h2>Version 0.4.1 (2011-05-06)</h2>
<ul>
<li>FIX: Stopped `gem install asset_hat` from foolishly requiring itself.
View
4 doc/files/LICENSE.html
@@ -31,14 +31,14 @@ <h1 class='name'>LICENSE</h1>
</div>
<div class='last-update'>
Last Update:
- <span class='datetime'>Fri May 06 17:23:46 -0400 2011</span>
+ <span class='datetime'>Mon Aug 08 12:28:21 -0400 2011</span>
</div>
</div>
<div id='content'>
<div id='text'>
<div id='description'>
<p>
- Copyright &#169; 2010 Ron DeVera, Mint Digital
+ Copyright &#169; 2011 Ron DeVera, Mint Digital
</p>
<p>
Permission is hereby granted, free of charge, to any person obtaining a
View
204 doc/files/README_rdoc.html
@@ -9,14 +9,14 @@
function popupCode(url) {
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
}
-
+
function toggleCode(id) {
var code = document.getElementById(id)
-
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
return true
}
-
+
// Make codeblocks hidden by default
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
//]]>
@@ -31,7 +31,7 @@
</div>
<div class='last-update'>
Last Update:
- <span class='datetime'>Wed Jun 01 08:31:46 -0400 2011</span>
+ <span class='datetime'>Mon Aug 08 12:28:21 -0400 2011</span>
</div>
</div>
<div id='content'>
@@ -39,7 +39,7 @@
<div id='description'>
<h1><a href="../classes/AssetHat.html">AssetHat</a></h1>
<p>
- Your assets are covered.
+ Load CSS and JS faster. Your assets are covered.
</p>
<p>
With Rails&#8217; default asset caching, CSS and JS are concatenated (not
@@ -50,22 +50,28 @@
<ul>
<li>Easily <b>minify</b> and <b>bundle</b> CSS and JS to reduce file sizes and
HTTP requests. Do this on deploy, and avoid any performance hit at runtime.
-
+
</li>
- <li>Load popular <b>third-party JS</b> (like jQuery, YUI, and Ext JS) from <a
+ <li>Load <b>popular libraries from the JS community</b> &#8212; like jQuery,
+ YUI, and Dojo &#8212; from <a
href="http://code.google.com/apis/ajaxlibs/">Google's CDN</a> when in
production, or from localhost in development. It&#8217;s as simple as
<tt>&lt;%= include_js :jquery %&gt;</tt> to load straight from Google.
-
+
+ </li>
+ <li>Load plenty of JS files in parallel in <b><a
+ href="http://labjs.com/">LABjs</a> mode</b>. When calling
+ <tt>include_js</tt>, just add <tt>:loader =&gt; :lab_js</tt>.
+
</li>
<li>Force image URLs in your CSS to use <b>CDN subdomains</b> (including SSL
support), not just the current host.
-
+
</li>
<li>Add an image&#8217;s last <a href="http://git-scm.com/">Git</a> commit ID
to its CSS URLs to <b>bust browser caches</b> (e.g.,
<tt>/images/foo.png?ab12cd3</tt>).
-
+
</li>
</ul>
<p>
@@ -78,9 +84,9 @@
<pre>&lt;link href=&quot;/stylesheets/bundles/application.min.css&quot;&#x000A; media=&quot;screen,projection&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;&#x000A;&lt;script src=&quot;/javascripts/jquery-1.x.x.min.js&quot;&#x000A; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&#x000A; &lt;!-- In production, jQuery loads from Google's CDN instead. --&gt;&#x000A;&lt;script src=&quot;/javascripts/bundles/plugins.min.js&quot;&#x000A; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&#x000A;&lt;script src=&quot;/javascripts/bundles/common.min.js&quot;&#x000A; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
<p>
Don&#8217;t have your own copy of jQuery? <a
- href="../classes/AssetHat.html">AssetHat</a> detects this and loads jQuery
- from Google&#8217;s CDN instead, whether you&#8217;re in development or
- production.
+ href="../classes/AssetHat.html">AssetHat</a> detects this and knows how to
+ load jQuery from Google&#8217;s CDN instead, whether you&#8217;re in
+ development or production.
</p>
<p>
Add this to your deploy script, and your CSS/JS will be optimized
@@ -88,84 +94,81 @@
</p>
<pre>rake asset_hat:minify</pre>
<p>
- Tested with Rails 2.3.x. For a quick overview, see <a
- href="http://mintdigital.github.com/asset_hat/">the AssetHat website</a>.
- For the gritty details, check the <a
+ Tested with Rails 3 and Rails 2.3.x (with Bundler). For a quick overview,
+ see <a href="http://mintdigital.github.com/asset_hat/">the AssetHat
+ website</a>. To see how <a href="../classes/AssetHat.html">AssetHat</a>
+ performs in production, <a
+ href="http://logicalfriday.com/2011/05/06/assethat-0-4-load-css-and-js-faster-your-assets-are-covered/">check
+ some stats</a>. For the gritty details, check the <a
href="http://mintdigital.github.com/asset_hat/doc/">complete docs</a> and
<a
href="http://mintdigital.github.com/asset_hat/doc/files/HISTORY.html">change
history</a>.
</p>
<h2>Installation</h2>
- <ul>
- <li>Rails 3.x:
-
+ <h3>Rails 3.x</h3>
<ol>
<li>Add to your app&#8217;s Gemfile: <tt>gem 'asset_hat', '0.x.x'</tt>
-
+
</li>
<li>Command-line: <tt>bundle install</tt>
-
+
</li>
</ol>
- </li>
- <li>Rails 2.3.x:
-
+ <h3>Rails 2.3.x</h3>
<ol>
<li>Add the gem:
-
+
<ul>
<li>If you&#8217;re using <a href="http://github.com/carlhuda/bundler">Bundler
0.9+</a>:
-
+
<ol>
<li>Add to your app&#8217;s Gemfile: <tt>gem 'asset_hat', '0.x.x'</tt>
-
+
</li>
<li>Command-line: <tt>bundle install</tt>
-
+
</li>
</ol>
</li>
<li>If you&#8217;re using Rails 2.3.x&#8217;s <tt>config.gem</tt>:
-
+
<ol>
<li>Add to your app&#8217;s <tt>config/environment.rb</tt>: <tt>config.gem
'asset_hat', :version =&gt; '0.x.x'</tt>
-
+
</li>
<li>Command-line: <tt>gem install asset_hat</tt>
-
+
</li>
</ol>
</li>
</ul>
</li>
<li>Add to your app&#8217;s Rakefile: <tt>require 'asset_hat/tasks'</tt>
-
+
</li>
</ol>
- </li>
- </ul>
<h2>Quick start &amp; configuration</h2>
<ol>
<li>In all of your layouts and views, change <tt>stylesheet_link_tag</tt> to
<tt>include_css</tt>, and change <tt>javascript_include_tag</tt> to
<tt>include_js</tt>. (Don&#8217;t worry, these helpers use the same
arguments as Rails&#8217; helpers. Nothing will break.)
-
+
</li>
<li>Create the default config file:
-
+
<pre>rake asset_hat:config</pre>
</li>
<li>In your app, open the new file at <tt>config/assets.yml</tt>, and set up
your CSS/JS bundles according to that file&#8217;s example.
-
+
</li>
<li>In your layouts and views, switch to the new bundles. For example, if you
originally had this:
-
+
<pre>&lt;%# app/views/layouts/application.html.erb: %&gt;&#x000A;&lt;%= stylesheet_include_tag 'reset', 'application' %&gt;</pre>
<p>
Then you&#8217;ll now have:
@@ -173,7 +176,7 @@
<pre># config/assets.yml:&#x000A;css:&#x000A; bundles:&#x000A; application: ['reset', 'application']&#x000A;&#x000A;&lt;%# app/views/layouts/application.html.erb: %&gt;&#x000A;&lt;%= include_css :bundle =&gt; 'application' %&gt;</pre>
</li>
<li>Add this to your deployment script:
-
+
<pre>rake asset_hat:minify</pre>
<p>
This minifies all of the CSS/JS files listed in <tt>config/assets.yml</tt>,
@@ -186,6 +189,14 @@
<tt>public/stylesheets/bundles/</tt> and
<tt>public/javascripts/bundles/</tt>.
</p>
+ <p>
+ If you&#8217;re using a CSS/JS layer like SASS or CoffeeScript, be sure to
+ compile/transpile to regular CSS/JS before running <tt>rake
+ asset_hat:minify</tt>. (When <a
+ href="../classes/AssetHat.html">AssetHat</a> is ready for Rails 3.1,
+ <tt>rake asset_hat:minify</tt> will automatically start with <tt>rake
+ assets:precompile</tt>.)
+ </p>
</li>
</ol>
<h3>Advanced configuration</h3>
@@ -216,7 +227,7 @@
Lecomte&#8217;s YUI Compressor and Schlueter&#8217;s PHP cssmin), and JS is
minified with <a href="http://github.com/rgrove/jsmin">rgrove/jsmin</a> (a
Ruby port of Crockford&#8217;s JSMin).
-
+
<p>
If you&#8217;d prefer to have slightly more readable code for debugging
purposes, you can switch both the CSS and JS engines to <tt>weak</tt>.
@@ -226,7 +237,7 @@
<li><tt>vendors</tt>: Configures third-party JS that&#8217;s loaded from a CDN
or other external source. The following example configures jQuery and
jQuery UI for use throughout the app:
-
+
<pre>js:&#x000A; vendors:&#x000A; jquery:&#x000A; version: 1.5.2&#x000A; jquery_ui:&#x000A; version: 1.8.12&#x000A; remote_url: http://cdn.example.com/js/jquery-ui-1.8.12.min.js&#x000A; remote_ssl_url: https://cdn-ssl.example.com/js/jquery-ui-1.8.12.min.js</pre>
<p>
Configuration keys per vendor:
@@ -236,7 +247,7 @@
above, <tt>&lt;%= include_js :jquery %&gt;</tt> uses version 1.5.2 by
default. You can override this for special layouts/views with <tt>&lt;%=
include_js :jquery, :version =&gt; '1.3.2' %&gt;</tt>.
-
+
</li>
<li><tt>remote_url</tt>, <tt>remote_ssl_url</tt>: By default, vendor JS will
load from <a href="http://code.google.com/apis/ajaxlibs/">Google's CDN</a>
@@ -246,12 +257,11 @@
JS will also load from Google&#8217;s CDN via SSL. If you prefer to use a
different CDN, specify its SSL/non-SSL URLs, and the appropriate URL will
be used per request.
-
+
</li>
</ul>
<p>
- A full list of supported vendors is in the <a
- href="../classes/AssetHat/JS/Vendors.html">AssetHat::JS::Vendors</a>
+ A full list of supported vendors is in the <tt>AssetHat::JS::Vendors</tt>
module.
</p>
</li>
@@ -319,6 +329,45 @@
When including multiple bundles at once, this yields one
<tt>&lt;link&gt;</tt> or <tt>&lt;script&gt;</tt> element per bundle.
</p>
+ <h3>LABjs mode</h3>
+ <p>
+ Say you&#8217;re loading several JS bundles. However, because there are so
+ many, you decide to try a popular script loader like <a
+ href="http://labjs.com/">LABjs</a> to see how much it improves performance.
+ Here&#8217;s how it&#8217;s done the old Rails way:
+ </p>
+ <pre>&lt;%= javascript_include_tag 'LAB-1.2.0.min.js' %&gt;&#x000A;&lt;script&gt;&#x000A; $LAB.&#x000A; script('/javascripts/jquery-1.6.1.min.js').wait().&#x000A; script('/javascripts/common.js').wait().&#x000A; script('/javascripts/search.js').wait().&#x000A; script('/javascripts/app.js').wait();&#x000A;&lt;/script&gt;</pre>
+ <p>
+ What a hassle. With <a href="../classes/AssetHat.html">AssetHat</a>, just
+ set up a bundle in <tt>config/assets.yml</tt>:
+ </p>
+ <pre>js:&#x000A; bundles:&#x000A; app:&#x000A; - common&#x000A; - search&#x000A; - app</pre>
+ <p>
+ Ready to go. Here&#8217;s how to load jQuery and your bundle normally:
+ </p>
+ <pre>&lt;%= include_js :jquery, :bundle =&gt; 'app' %&gt;</pre>
+ <p>
+ And here&#8217;s how to switch on LABjs mode:
+ </p>
+ <pre>&lt;%= include_js :jquery, :bundle =&gt; 'app',&#x000A; :loader =&gt; :lab_js %&gt;</pre>
+ <p>
+ Add your preferred jQuery and LABjs versions to the config file if you
+ haven&#8217;t already, and that&#8217;s it. If you don&#8217;t have a copy
+ of LABjs locally, <a href="../classes/AssetHat.html">AssetHat</a> knows how
+ to instead load it from <a href="http://cdnjs.com/">cdnjs</a>, which uses
+ high-speed Amazon Cloudfront servers.
+ </p>
+ <p>
+ This is just the most common LABjs use case. If you want to fine-tune it
+ even further, you can have the best of both worlds:
+ </p>
+ <pre>&lt;%= include_js :lab_js %&gt;&#x000A;&lt;script&gt;&#x000A; $LAB.&#x000A; script('&lt;%= include_js :jquery, :only_url =&gt; true %&gt;').wait().&#x000A; script('&lt;%= include_js &quot;common&quot;, :only_url =&gt; true %&gt;'). // Non-blocking&#x000A; script('&lt;%= include_js &quot;search&quot;, :only_url =&gt; true %&gt;').wait().&#x000A; script('&lt;%= include_js &quot;app&quot;, :only_url =&gt; true %&gt;').wait();&#x000A;&lt;/script&gt;</pre>
+ <p>
+ In this example, <tt>common</tt> is not a dependency for <tt>search</tt>,
+ so allow either to execute as soon as possible &#8212; whichever happens to
+ load first &#8212; rather than always forcing <tt>common</tt> to execute
+ first.
+ </p>
<h3>Bundle tips</h3>
<p>
Don&#8217;t go overboard with huge bundles:
@@ -326,31 +375,82 @@
<ul>
<li>Mobile browsers may not cache CSS/JS files that are too large, regardless
of gzipping. Check the latest specs for each mobile browser you support.
-
+
</li>
<li>You might want to put plugins (rarely changed) in one bundle, and
application code (frequently changed) in another bundle. This way, when the
app code changes, the browser re-downloads only the new app code, and uses
the cached plugin code.
-
+
</li>
<li>Regardless of code-change frequency, it&#8217;s sometimes faster to split a
bundle in half, and load each half in parallel (i.e., two HTTP requests
- instead of one). Your own tests will tell what&#8217;s optimal for your
+ instead of one). LABjs mode can help with loading several smaller bundles
+ in parallel. Your own tests will tell what&#8217;s optimal for your
situation.
-
+
+ </li>
+ </ul>
+ <h2>More info</h2>
+ <ul>
+ <li><a href="http://mintdigital.github.com/asset_hat/">Official website</a>
+
+ </li>
+ <li><a href="http://mintdigital.github.com/asset_hat/doc/">Full
+ documentation</a>
+
+ </li>
+ <li><a
+ href="http://mintdigital.github.com/asset_hat/doc/files/HISTORY.html">History/changelog</a>
+
+ </li>
+ <li>Released under the <a
+ href="https://github.com/mintdigital/asset_hat/blob/master/LICENSE">MIT
+ license</a>.
+
+ </li>
+ </ul>
+ <h3>Contributing</h3>
+ <p>
+ Have an idea, problem, or bug report? <a
+ href="http://help.github.com/send-pull-requests/">Send a pull request</a>!
+ Please base pull requests on the `development` branch, not the `master`
+ branch.
+ </p>
+ <p>
+ Contributors:
+ </p>
+ <ul>
+ <li><a href="https://github.com/rondevera">rondevera</a> (maintainer; Twitter:
+ <a href="https://twitter.com/#!/ronalddevera">@ronalddevera</a>)
+
+ </li>
+ <li><a href="https://github.com/philnash">philnash</a>
+
+ </li>
+ <li><a href="https://github.com/dstrelau">dstrelau</a>
+
+ </li>
+ <li><a href="https://github.com/daphonz">daphonz</a>
+
+ </li>
+ <li><a href="https://github.com/sauliusg">sauliusg</a>
+
+ </li>
+ <li><a href="https://github.com/jsonperl">jsonperl</a>
+
</li>
</ul>
<h2><a href="http://www.youtube.com/watch?v=V30tyaXv6EI">What is best in AssetHat?</a></h2>
<ul>
<li>To crush your assets;
-
+
</li>
<li>See them bundled before you; and
-
+
</li>
<li>Hear no more lamentation about slow page loads.
-
+
</li>
</ul>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.