doc/classes/AssetHat/CSS.html in asset_hat-0.3.1 vs doc/classes/AssetHat/CSS.html in asset_hat-0.4.0

- old
+ new

@@ -44,14 +44,14 @@ </div> <div id='method-list'> <h2>Methods</h2> <h3>public class</h3> <ol> - <li><a href="#M000018">add_asset_commit_ids</a></li> - <li><a href="#M000019">add_asset_hosts</a></li> - <li><a href="#M000016">min_filepath</a></li> - <li><a href="#M000017">minify</a></li> + <li><a href="#M000021">add_asset_commit_ids</a></li> + <li><a href="#M000022">add_asset_hosts</a></li> + <li><a href="#M000019">min_filepath</a></li> + <li><a href="#M000020">minify</a></li> </ol> </div> <div id='section'> <div id='class-list'> <h2>Classes and Modules</h2> @@ -74,12 +74,12 @@ </table> </div> </div> <div id='methods'> <h2>Public class methods</h2> - <div class='method public-class' id='method-M000018'> - <a name='M000018'></a> + <div class='method public-class' id='method-M000021'> + <a name='M000021'></a> <div class='synopsis'> <span class='name'>add_asset_commit_ids</span> <span class='arguments'>(css)</span> </div> <div class='description'> @@ -91,18 +91,18 @@ deployment, this new URL forces the browser to ignore that cache and request the latest version. </p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false"> [show source] </a> - <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 43</span>&#x000A;43: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_asset_commit_ids</span>(<span class="ruby-identifier">css</span>)&#x000A;44: <span class="ruby-identifier">update_css_urls</span>(<span class="ruby-identifier">css</span>, <span class="ruby-node">%w[images htc]</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">src</span>, <span class="ruby-identifier">quote</span><span class="ruby-operator">|</span>&#x000A;45: <span class="ruby-comment cmt"># Get absolute path</span>&#x000A;46: <span class="ruby-identifier">filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ASSETS_DIR</span>, <span class="ruby-identifier">src</span>)&#x000A;47: &#x000A;48: <span class="ruby-comment cmt"># Convert to relative path</span>&#x000A;49: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-node">/^#{FileUtils.pwd}#{File::SEPARATOR}/</span>, <span class="ruby-value str">''</span>)&#x000A;50: &#x000A;51: <span class="ruby-identifier">commit_id</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-identifier">filepath</span>)&#x000A;52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commit_id</span>.<span class="ruby-identifier">present?</span>&#x000A;53: <span class="ruby-node">&quot;url(#{quote}#{src}#{src =~ /\?/ ? '&amp;' : '?'}#{commit_id}#{quote})&quot;</span>&#x000A;54: <span class="ruby-keyword kw">else</span>&#x000A;55: <span class="ruby-node">&quot;url(#{quote}#{src}#{quote})&quot;</span>&#x000A;56: <span class="ruby-keyword kw">end</span>&#x000A;57: <span class="ruby-keyword kw">end</span>&#x000A;58: <span class="ruby-keyword kw">end</span></pre> + <pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 43</span>&#x000A;43: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_asset_commit_ids</span>(<span class="ruby-identifier">css</span>)&#x000A;44: <span class="ruby-identifier">update_css_urls</span>(<span class="ruby-identifier">css</span>, <span class="ruby-node">%w[images htc]</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">src</span>, <span class="ruby-identifier">quote</span><span class="ruby-operator">|</span>&#x000A;45: <span class="ruby-comment cmt"># Get absolute path</span>&#x000A;46: <span class="ruby-identifier">filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ASSETS_DIR</span>, <span class="ruby-identifier">src</span>)&#x000A;47: &#x000A;48: <span class="ruby-comment cmt"># Convert to relative path</span>&#x000A;49: <span class="ruby-identifier">filepath</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-node">/^#{FileUtils.pwd}#{File::SEPARATOR}/</span>, <span class="ruby-value str">''</span>)&#x000A;50: &#x000A;51: <span class="ruby-identifier">commit_id</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">last_commit_id</span>(<span class="ruby-identifier">filepath</span>)&#x000A;52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commit_id</span>.<span class="ruby-identifier">present?</span>&#x000A;53: <span class="ruby-node">&quot;url(#{quote}#{src}#{src =~ /\?/ ? '&amp;' : '?'}#{commit_id}#{quote})&quot;</span>&#x000A;54: <span class="ruby-keyword kw">else</span>&#x000A;55: <span class="ruby-node">&quot;url(#{quote}#{src}#{quote})&quot;</span>&#x000A;56: <span class="ruby-keyword kw">end</span>&#x000A;57: <span class="ruby-keyword kw">end</span>&#x000A;58: <span class="ruby-keyword kw">end</span></pre> </div> </div> - <div class='method public-class' id='method-M000019'> - <a name='M000019'></a> + <div class='method public-class' id='method-M000022'> + <a name='M000022'></a> <div class='synopsis'> <span class='name'>add_asset_hosts</span> <span class='arguments'>(css, asset_host, options={})</span> </div> <div class='description'> @@ -135,18 +135,18 @@ </dd> </dl> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false"> [show source] </a> - <pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 77</span>&#x000A;77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_asset_hosts</span>(<span class="ruby-identifier">css</span>, <span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">options</span>={})&#x000A;78: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">css</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">asset_host</span>.<span class="ruby-identifier">blank?</span>&#x000A;79: &#x000A;80: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>)&#x000A;81: &#x000A;82: <span class="ruby-identifier">update_css_urls</span>(<span class="ruby-identifier">css</span>, <span class="ruby-node">%w[images]</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">src</span>, <span class="ruby-identifier">quote</span><span class="ruby-operator">|</span>&#x000A;83: <span class="ruby-identifier">computed_asset_host</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(&#x000A;84: <span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">src</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">:ssl</span>))&#x000A;85: <span class="ruby-node">&quot;url(#{quote}#{computed_asset_host}#{src}#{quote})&quot;</span>&#x000A;86: <span class="ruby-keyword kw">end</span>&#x000A;87: <span class="ruby-keyword kw">end</span></pre> + <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 77</span>&#x000A;77: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">add_asset_hosts</span>(<span class="ruby-identifier">css</span>, <span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">options</span>={})&#x000A;78: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">css</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">asset_host</span>.<span class="ruby-identifier">blank?</span>&#x000A;79: &#x000A;80: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">false</span>)&#x000A;81: &#x000A;82: <span class="ruby-identifier">update_css_urls</span>(<span class="ruby-identifier">css</span>, <span class="ruby-node">%w[images]</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">src</span>, <span class="ruby-identifier">quote</span><span class="ruby-operator">|</span>&#x000A;83: <span class="ruby-identifier">computed_asset_host</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(&#x000A;84: <span class="ruby-identifier">asset_host</span>, <span class="ruby-identifier">src</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">:ssl</span>))&#x000A;85: <span class="ruby-node">&quot;url(#{quote}#{computed_asset_host}#{src}#{quote})&quot;</span>&#x000A;86: <span class="ruby-keyword kw">end</span>&#x000A;87: <span class="ruby-keyword kw">end</span></pre> </div> </div> - <div class='method public-class' id='method-M000016'> - <a name='M000016'></a> + <div class='method public-class' id='method-M000019'> + <a name='M000019'></a> <div class='synopsis'> <span class='name'>min_filepath</span> <span class='arguments'>(filepath)</span> </div> <div class='description'> @@ -155,18 +155,18 @@ href="CSS.html">CSS</a> asset: </p> <pre>AssetHat::CSS.min_filepath('public/stylesheets/bundles/application.css')&#x000A; # =&gt; 'public/stylesheets/bundles/application.min.css'</pre> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false"> [show source] </a> - <pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 14</span>&#x000A;14: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>)&#x000A;15: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>, <span class="ruby-value str">'css'</span>)&#x000A;16: <span class="ruby-keyword kw">end</span></pre> + <pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 14</span>&#x000A;14: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>)&#x000A;15: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">min_filepath</span>(<span class="ruby-identifier">filepath</span>, <span class="ruby-value str">'css'</span>)&#x000A;16: <span class="ruby-keyword kw">end</span></pre> </div> </div> - <div class='method public-class' id='method-M000017'> - <a name='M000017'></a> + <div class='method public-class' id='method-M000020'> + <a name='M000020'></a> <div class='synopsis'> <span class='name'>minify</span> <span class='arguments'>(input_string, options={})</span> </div> <div class='description'> @@ -175,20 +175,20 @@ href="CSS.html">CSS</a> minified. Options: </p> <dl> <dt>engine</dt><dd>Default is <tt>:cssmin</tt>; see <a href=CSS/Engines.html#method-c-cssmin><a - href="CSS/Engines.html#M000021">Engines.cssmin</a></a>. Allowed values are + href="CSS/Engines.html#M000024">Engines.cssmin</a></a>. Allowed values are in ENGINES. </dd> </dl> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false"> [show source] </a> - <pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 23</span>&#x000A;23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minify</span>(<span class="ruby-identifier">input_string</span>, <span class="ruby-identifier">options</span>={})&#x000A;24: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:engine</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:cssmin</span>)&#x000A;25: &#x000A;26: <span class="ruby-identifier">engine</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:engine</span>].<span class="ruby-identifier">to_sym</span>&#x000A;27: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">ENGINES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">engine</span>)&#x000A;28: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{&#x000A;29: Unknown CSS minification engine '#{engine}'.&#x000A;30: Allowed: #{ENGINES.map{ |e| &quot;'#{e}'&quot; }.join(', ')}&#x000A;31: }</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\s+/</span>, <span class="ruby-value str">' '</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>&#x000A;32: <span class="ruby-keyword kw">end</span>&#x000A;33: &#x000A;34: <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">CSS</span><span class="ruby-operator">::</span><span class="ruby-constant">Engines</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">engine</span>, <span class="ruby-identifier">input_string</span>).<span class="ruby-identifier">strip</span>&#x000A;35: <span class="ruby-keyword kw">end</span></pre> + <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/asset_hat/css.rb, line 23</span>&#x000A;23: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minify</span>(<span class="ruby-identifier">input_string</span>, <span class="ruby-identifier">options</span>={})&#x000A;24: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:engine</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:cssmin</span>)&#x000A;25: &#x000A;26: <span class="ruby-identifier">engine</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:engine</span>].<span class="ruby-identifier">to_sym</span>&#x000A;27: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">ENGINES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">engine</span>)&#x000A;28: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{&#x000A;29: Unknown CSS minification engine '#{engine}'.&#x000A;30: Allowed: #{ENGINES.map{ |e| &quot;'#{e}'&quot; }.join(', ')}&#x000A;31: }</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\s+/</span>, <span class="ruby-value str">' '</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span>&#x000A;32: <span class="ruby-keyword kw">end</span>&#x000A;33: &#x000A;34: <span class="ruby-constant">AssetHat</span><span class="ruby-operator">::</span><span class="ruby-constant">CSS</span><span class="ruby-operator">::</span><span class="ruby-constant">Engines</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">engine</span>, <span class="ruby-identifier">input_string</span>).<span class="ruby-identifier">strip</span>&#x000A;35: <span class="ruby-keyword kw">end</span></pre> </div> </div> </div> </div> </div>