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>
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>)
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>
45: <span class="ruby-comment cmt"># Get absolute path</span>
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>)
47: 
48: <span class="ruby-comment cmt"># Convert to relative path</span>
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>)
50: 
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>)
52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commit_id</span>.<span class="ruby-identifier">present?</span>
53: <span class="ruby-node">"url(#{quote}#{src}#{src =~ /\?/ ? '&' : '?'}#{commit_id}#{quote})"</span>
54: <span class="ruby-keyword kw">else</span>
55: <span class="ruby-node">"url(#{quote}#{src}#{quote})"</span>
56: <span class="ruby-keyword kw">end</span>
57: <span class="ruby-keyword kw">end</span>
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>
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>)
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>
45: <span class="ruby-comment cmt"># Get absolute path</span>
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>)
47: 
48: <span class="ruby-comment cmt"># Convert to relative path</span>
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>)
50: 
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>)
52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">commit_id</span>.<span class="ruby-identifier">present?</span>
53: <span class="ruby-node">"url(#{quote}#{src}#{src =~ /\?/ ? '&' : '?'}#{commit_id}#{quote})"</span>
54: <span class="ruby-keyword kw">else</span>
55: <span class="ruby-node">"url(#{quote}#{src}#{quote})"</span>
56: <span class="ruby-keyword kw">end</span>
57: <span class="ruby-keyword kw">end</span>
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>
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>={})
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>
79: 
80: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>)
81: 
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>
83: <span class="ruby-identifier">computed_asset_host</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(
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>))
85: <span class="ruby-node">"url(#{quote}#{computed_asset_host}#{src}#{quote})"</span>
86: <span class="ruby-keyword kw">end</span>
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>
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>={})
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>
79: 
80: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:ssl</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">false</span>)
81: 
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>
83: <span class="ruby-identifier">computed_asset_host</span> = <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">compute_asset_host</span>(
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>))
85: <span class="ruby-node">"url(#{quote}#{computed_asset_host}#{src}#{quote})"</span>
86: <span class="ruby-keyword kw">end</span>
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')
 # => '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>
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>)
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>)
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>
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>)
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>)
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>
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>={})
24: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:engine</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:cssmin</span>)
25: 
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>
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>)
28: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{
29: Unknown CSS minification engine '#{engine}'.
30: Allowed: #{ENGINES.map{ |e| "'#{e}'" }.join(', ')}
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>
32: <span class="ruby-keyword kw">end</span>
33: 
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>
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>
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>={})
24: <span class="ruby-identifier">options</span>.<span class="ruby-identifier">reverse_merge!</span>(<span class="ruby-identifier">:engine</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:cssmin</span>)
25: 
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>
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>)
28: <span class="ruby-identifier">raise</span> <span class="ruby-node">%{
29: Unknown CSS minification engine '#{engine}'.
30: Allowed: #{ENGINES.map{ |e| "'#{e}'" }.join(', ')}
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>
32: <span class="ruby-keyword kw">end</span>
33: 
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>
35: <span class="ruby-keyword kw">end</span></pre>
</div>
</div>
</div>
</div>
</div>