asset_hat 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/HISTORY +13 -14
  2. data/README.rdoc +171 -0
  3. data/Rakefile +24 -2
  4. data/VERSION.yml +3 -3
  5. data/app/helpers/asset_hat_helper.rb +67 -61
  6. data/asset_hat.gemspec +42 -8
  7. data/doc/classes/AssetHat/CSS/Engines.html +118 -0
  8. data/doc/classes/AssetHat/CSS.html +194 -0
  9. data/doc/classes/AssetHat/JS/Engines.html +122 -0
  10. data/doc/classes/AssetHat/JS/Vendors.html +110 -0
  11. data/doc/classes/AssetHat/JS.html +151 -0
  12. data/doc/classes/AssetHat.html +446 -0
  13. data/doc/classes/AssetHatHelper.html +161 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/HISTORY.html +116 -0
  16. data/doc/files/LICENSE.html +76 -0
  17. data/doc/files/README_rdoc.html +234 -0
  18. data/doc/files/app/helpers/asset_hat_helper_rb.html +55 -0
  19. data/doc/files/lib/asset_hat/capistrano_rb.html +49 -0
  20. data/doc/files/lib/asset_hat/css_rb.html +57 -0
  21. data/doc/files/lib/asset_hat/js/vendors_rb.html +49 -0
  22. data/doc/files/lib/asset_hat/js_rb.html +57 -0
  23. data/doc/files/lib/asset_hat/tasks/css_rb.html +49 -0
  24. data/doc/files/lib/asset_hat/tasks/js_rb.html +49 -0
  25. data/doc/files/lib/asset_hat/tasks_rb.html +58 -0
  26. data/doc/files/lib/asset_hat/vcs_rb.html +49 -0
  27. data/doc/files/lib/asset_hat/version_rb.html +49 -0
  28. data/doc/files/lib/asset_hat_rb.html +49 -0
  29. data/doc/fr_class_index.html +23 -0
  30. data/doc/fr_file_index.html +33 -0
  31. data/doc/fr_method_index.html +4455 -0
  32. data/doc/index.html +15 -0
  33. data/doc/rdoc-style.css +328 -0
  34. data/lib/asset_hat/capistrano.rb +14 -0
  35. data/lib/asset_hat/css.rb +40 -10
  36. data/lib/asset_hat/js/vendors.rb +85 -0
  37. data/lib/asset_hat/js.rb +28 -29
  38. data/lib/asset_hat/tasks/css.rb +151 -0
  39. data/lib/asset_hat/tasks/js.rb +100 -0
  40. data/lib/asset_hat/tasks.rb +4 -272
  41. data/lib/asset_hat/vcs.rb +23 -20
  42. data/lib/asset_hat/version.rb +2 -0
  43. data/lib/asset_hat.rb +94 -19
  44. data/tasks/asset_hat.rake +1 -1
  45. data/test/asset_hat_helper_test.rb +63 -9
  46. data/test/test_helper.rb +5 -1
  47. metadata +94 -26
  48. data/README.markdown +0 -154
@@ -0,0 +1,161 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html lang='en'>
3
+ <head>
4
+ <title>: AssetHatHelper [AssetHat]</title>
5
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
+ <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
+ <script type='text/javascript'>
8
+ //<![CDATA[
9
+ function popupCode(url) {
10
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
+ }
12
+
13
+ function toggleCode(id) {
14
+ var code = document.getElementById(id)
15
+
16
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
+ return true
18
+ }
19
+
20
+ // Make codeblocks hidden by default
21
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
+ //]]>
23
+ </script>
24
+ </head>
25
+ <body class='page'>
26
+ <div class='class' id='wrapper'>
27
+ <div class='header'>
28
+ <h1 class='name'>
29
+ <span class='type'>Module</span>
30
+ AssetHatHelper
31
+ </h1>
32
+ <ol class='paths'>
33
+ <li>
34
+ <a href="../files/app/helpers/asset_hat_helper_rb.html">app/helpers/asset_hat_helper.rb</a>
35
+ </li>
36
+ </ol>
37
+ </div>
38
+ <div id='content'>
39
+ <div id='text'>
40
+ <div id='description'>
41
+ <p>
42
+ Helpers for use in layouts for global includes, and in views for
43
+ view-specific includes.
44
+ </p>
45
+ </div>
46
+ <div id='method-list'>
47
+ <h2>Methods</h2>
48
+ <h3>public instance</h3>
49
+ <ol>
50
+ <li><a href="#M000023">include_css</a></li>
51
+ <li><a href="#M000024">include_js</a></li>
52
+ </ol>
53
+ </div>
54
+ <div id='section'>
55
+ <div id='constants-list'>
56
+ <h2>Constants</h2>
57
+ <div class='name-list'>
58
+ <table summary='Constants'>
59
+ <tr class='top-aligned-row context-row'>
60
+ <td class='context-item-name'>RAILS_ROOT</td>
61
+ <td>=</td>
62
+ <td class='context-item-value'>File.join(File.dirname(__FILE__), '..', '..')</td>
63
+ </tr>
64
+ </table>
65
+ </div>
66
+ </div>
67
+ <div id='methods'>
68
+ <h2>Public instance methods</h2>
69
+ <div class='method public-instance' id='method-M000023'>
70
+ <a name='M000023'></a>
71
+ <div class='synopsis'>
72
+ <span class='name'>include_css</span>
73
+ <span class='arguments'>(*args)</span>
74
+ </div>
75
+ <div class='description'>
76
+ <p>
77
+ <tt><a href="AssetHatHelper.html#M000023">include_css</a></tt> is a smart
78
+ wrapper for Rails&#8217; <tt>stylesheet_link_tag</tt>. The two can be used
79
+ together while migrating to <a href="AssetHat.html">AssetHat</a>.
80
+ </p>
81
+ <p>
82
+ Include a single stylesheet:
83
+ </p>
84
+ <pre>include_css 'diagnostics'&#x000A;=&gt; &lt;link href=&quot;/stylesheets/diagnostics.min.css&quot; media=&quot;screen,projection&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</pre>
85
+ <p>
86
+ Include a single unminified stylesheet:
87
+ </p>
88
+ <pre>include_css 'diagnostics.css'&#x000A;=&gt; &lt;link href=&quot;/stylesheets/diagnostics.css&quot; media=&quot;screen,projection&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</pre>
89
+ <p>
90
+ Include a bundle of stylesheets (i.e., a concatenated set of stylesheets;
91
+ configure in config/assets.yml):
92
+ </p>
93
+ <pre>include_css :bundle =&gt; 'application'&#x000A;=&gt; &lt;link href=&quot;/stylesheets/bundles/application.min.css&quot; ... /&gt;</pre>
94
+ <p>
95
+ Include multiple stylesheets separately (not as cool):
96
+ </p>
97
+ <pre>include_css 'reset', 'application', 'clearfix'&#x000A;=&gt; &lt;link href=&quot;/stylesheets/reset.min.css&quot; ... /&gt;&#x000A; &lt;link href=&quot;/stylesheets/application.min.css&quot; ... /&gt;&#x000A; &lt;link href=&quot;/stylesheets/clearfix.min.css&quot; ... /&gt;</pre>
98
+ </div>
99
+ <div class='source'>
100
+ <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
101
+ [show source]
102
+ </a>
103
+ <pre id='M000023-source'> <span class="ruby-comment cmt"># File app/helpers/asset_hat_helper.rb, line 122</span>&#x000A;122: <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;123: <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;124: &#x000A;125: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span> <span class="ruby-operator">||=</span> {}&#x000A;126: <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;127: <span class="ruby-identifier">cache_key</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">inspect</span>&#x000A;128: &#x000A;129: <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;130: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;131: <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>] = <span class="ruby-identifier">include_assets</span>(<span class="ruby-identifier">:css</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;132: <span class="ruby-keyword kw">end</span>&#x000A;133: &#x000A;134: <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;135: <span class="ruby-identifier">html</span>&#x000A;136: <span class="ruby-keyword kw">end</span></pre>
104
+ </div>
105
+ </div>
106
+ <div class='method public-instance' id='method-M000024'>
107
+ <a name='M000024'></a>
108
+ <div class='synopsis'>
109
+ <span class='name'>include_js</span>
110
+ <span class='arguments'>(*args)</span>
111
+ </div>
112
+ <div class='description'>
113
+ <p>
114
+ <tt><a href="AssetHatHelper.html#M000024">include_js</a></tt> is a smart
115
+ wrapper for Rails&#8217; <tt>javascript_include_tag</tt>. The two can be
116
+ used together while migrating to <a href="AssetHat.html">AssetHat</a>.
117
+ </p>
118
+ <p>
119
+ Include a single JS file:
120
+ </p>
121
+ <pre>include_js 'application'&#x000A;=&gt; &lt;script src=&quot;/javascripts/application.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
122
+ <p>
123
+ Include a single JS unminified file:
124
+ </p>
125
+ <pre>include_js 'application.js'&#x000A;=&gt; &lt;script src=&quot;/javascripts/application.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
126
+ <p>
127
+ Include jQuery:
128
+ </p>
129
+ <pre>include_js :jquery # Development/test environment&#x000A;=&gt; &lt;script src=&quot;/javascripts/jquery-VERSION.min.js&quot; ...&gt;&lt;/script&gt;&#x000A;include_js :jquery # Staging/production environment&#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.4'`.</pre>
130
+ <p>
131
+ Include a bundle of JS files (i.e., a concatenated set of files; configure
132
+ in config/assets.yml):
133
+ </p>
134
+ <pre>include_js :bundle =&gt; 'application'&#x000A;=&gt; &lt;script src=&quot;/javascripts/bundles/application.min.js&quot; ...&gt;&lt;/script&gt;</pre>
135
+ <p>
136
+ Include multiple bundles of JS files:
137
+ </p>
138
+ <pre>include_js :bundles =&gt; %w[plugins common]&#x000A;=&gt; &lt;script src=&quot;/javascripts/bundles/plugins.min.js&quot; ...&gt;&lt;/script&gt;&#x000A; &lt;script src=&quot;/javascripts/bundles/common.min.js&quot; ...&gt;&lt;/script&gt;</pre>
139
+ <p>
140
+ Include multiple JS files separately (not as cool):
141
+ </p>
142
+ <pre>include_js 'bloombox', 'jquery.cookie', 'jquery.json.min'&#x000A;=&gt; &lt;script src=&quot;/javascripts/bloombox.min.js&quot; ...&gt;&lt;/script&gt;&#x000A; &lt;script src=&quot;/javascripts/jquery.cookie.min.js&quot; ...&gt;&lt;/script&gt;&#x000A; &lt;script src=&quot;/javascripts/jquery.json.min.js&quot; ...&gt;&lt;/script&gt;</pre>
143
+ </div>
144
+ <div class='source'>
145
+ <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
146
+ [show source]
147
+ </a>
148
+ <pre id='M000024-source'> <span class="ruby-comment cmt"># File app/helpers/asset_hat_helper.rb, line 173</span>&#x000A;173: <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;174: <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;175: &#x000A;176: <span class="ruby-constant">AssetHat</span>.<span class="ruby-identifier">html_cache</span> <span class="ruby-operator">||=</span> {}&#x000A;177: <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;178: <span class="ruby-identifier">cache_key</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">inspect</span>&#x000A;179: &#x000A;180: <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;181: <span class="ruby-comment cmt"># Generate HTML and write to cache</span>&#x000A;182: &#x000A;183: <span class="ruby-identifier">html</span> = []&#x000A;184: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">extract_options!</span>&#x000A;185: &#x000A;186: <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;187: <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;188: <span class="ruby-identifier">args</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">vendor</span>&#x000A;189: <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>(<span class="ruby-identifier">vendor</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-identifier">:version</span>))&#x000A;190: <span class="ruby-identifier">html</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>, <span class="ruby-identifier">:cache</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>)&#x000A;191: <span class="ruby-keyword kw">end</span>&#x000A;192: &#x000A;193: <span class="ruby-identifier">html</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">options</span>]))&#x000A;194: <span class="ruby-identifier">html</span> = <span class="ruby-identifier">html</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">&quot;\n&quot;</span>).<span class="ruby-identifier">strip</span>&#x000A;195: <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;196: <span class="ruby-keyword kw">end</span>&#x000A;197: &#x000A;198: <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;199: <span class="ruby-identifier">html</span>&#x000A;200: <span class="ruby-keyword kw">end</span></pre>
149
+ </div>
150
+ </div>
151
+ </div>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ <div id='footer-push'></div>
156
+ </div>
157
+ <div id='footer'>
158
+ <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
159
+ </div>
160
+ </body>
161
+ </html>
data/doc/created.rid ADDED
@@ -0,0 +1 @@
1
+ Thu, 10 Jun 2010 11:23:18 -0400
@@ -0,0 +1,116 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html lang='en'>
3
+ <head>
4
+ <title>File: HISTORY [AssetHat]</title>
5
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
+ <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
+ <script type='text/javascript'>
8
+ //<![CDATA[
9
+ function popupCode(url) {
10
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
+ }
12
+
13
+ function toggleCode(id) {
14
+ var code = document.getElementById(id)
15
+
16
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
+ return true
18
+ }
19
+
20
+ // Make codeblocks hidden by default
21
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
+ //]]>
23
+ </script>
24
+ </head>
25
+ <body class='page'>
26
+ <div class='file' id='wrapper'>
27
+ <div class='header'>
28
+ <div class='name'>HISTORY</div>
29
+ <div class='paths'>
30
+ HISTORY
31
+ </div>
32
+ <div class='last-update'>
33
+ Last Update:
34
+ <span class='datetime'>Thu Jun 10 11:22:45 -0400 2010</span>
35
+ </div>
36
+ </div>
37
+ <div id='content'>
38
+ <div id='text'>
39
+ <div id='description'>
40
+ <h1><a href="HISTORY.html">HISTORY</a></h1>
41
+ <ul>
42
+ <li>Added support for loading many more JS vendors from Google&#8217;s CDN,
43
+ including Prototype, MooTools, and SWFObject.
44
+
45
+ </li>
46
+ <li>Cleaned up existing docs, and added complete RDoc documentation.
47
+
48
+ </li>
49
+ <li>Added example integration script for Capistrano deployments.
50
+
51
+ </li>
52
+ </ul>
53
+ <h2>Version 0.1.5 (2010-03-11)</h2>
54
+ <ul>
55
+ <li>Fixed fetching asset commit IDs in some environments. The bug was possibly
56
+ caused by older versions of Git, which fail to read logs properly when
57
+ given absolute paths, rather than relative paths.
58
+
59
+ </li>
60
+ <li>Stopped app tests from running twice in some environments.
61
+
62
+ </li>
63
+ </ul>
64
+ <h2>Version 0.1.4 (2010-03-03)</h2>
65
+ <ul>
66
+ <li>Fixed config filepaths in `asset_hat:config` task.
67
+
68
+ </li>
69
+ </ul>
70
+ <h2>Version 0.1.3 (2010-03-03)</h2>
71
+ <ul>
72
+ <li>Allowed adding commit IDs and asset hosts to `url(/htc/...)` URLs (e.g.,
73
+ `/htc/iepngfix.htc`) in CSS, not just images.
74
+
75
+ </li>
76
+ <li>Changed `<a href="../classes/AssetHat.html#M000004">AssetHat.config</a>` to
77
+ memoize only if `cache?` is true. In development environments, this means
78
+ the config file will be reread with every request.
79
+
80
+ </li>
81
+ </ul>
82
+ <h2>Version 0.1.2 (2010-01-27)</h2>
83
+ <ul>
84
+ <li>Memoized HTML output from `include_css` and `include_js` when `<a
85
+ href="../classes/AssetHat.html#M000007">AssetHat.cache?</a>` is true.
86
+
87
+ </li>
88
+ </ul>
89
+ <h2>Version 0.1.1 (2010-01-20)</h2>
90
+ <ul>
91
+ <li>Rewrote `AssetHat::VERSION` to be based on `VERSION.yml`.
92
+
93
+ </li>
94
+ <li>Prefixed `AssetHat::CONFIG_FILEPATH` with `RAILS_ROOT`, which fixes ability
95
+ to run an app&#8217;s individual test files.
96
+
97
+ </li>
98
+ </ul>
99
+ <h2>Version 0.1.0 (2010-01-19)</h2>
100
+ <ul>
101
+ <li>Initial release.
102
+
103
+ </li>
104
+ </ul>
105
+ </div>
106
+ <div id='section'>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ <div id='footer-push'></div>
111
+ </div>
112
+ <div id='footer'>
113
+ <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
114
+ </div>
115
+ </body>
116
+ </html>
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html lang='en'>
3
+ <head>
4
+ <title>File: LICENSE [AssetHat]</title>
5
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
+ <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
+ <script type='text/javascript'>
8
+ //<![CDATA[
9
+ function popupCode(url) {
10
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
+ }
12
+
13
+ function toggleCode(id) {
14
+ var code = document.getElementById(id)
15
+
16
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
+ return true
18
+ }
19
+
20
+ // Make codeblocks hidden by default
21
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
+ //]]>
23
+ </script>
24
+ </head>
25
+ <body class='page'>
26
+ <div class='file' id='wrapper'>
27
+ <div class='header'>
28
+ <h1 class='name'>LICENSE</h1>
29
+ <div class='paths'>
30
+ LICENSE
31
+ </div>
32
+ <div class='last-update'>
33
+ Last Update:
34
+ <span class='datetime'>Thu Jun 10 11:22:45 -0400 2010</span>
35
+ </div>
36
+ </div>
37
+ <div id='content'>
38
+ <div id='text'>
39
+ <div id='description'>
40
+ <p>
41
+ Copyright &#169; 2010 Ron DeVera, Mint Digital
42
+ </p>
43
+ <p>
44
+ Permission is hereby granted, free of charge, to any person obtaining a
45
+ copy of this software and associated documentation files (the
46
+ &#8220;Software&#8221;), to deal in the Software without restriction,
47
+ including without limitation the rights to use, copy, modify, merge,
48
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
49
+ permit persons to whom the Software is furnished to do so, subject to the
50
+ following conditions:
51
+ </p>
52
+ <p>
53
+ The above copyright notice and this permission notice shall be included in
54
+ all copies or substantial portions of the Software.
55
+ </p>
56
+ <p>
57
+ THE SOFTWARE IS PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY KIND,
58
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
59
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
60
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
61
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
62
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
63
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
64
+ </p>
65
+ </div>
66
+ <div id='section'>
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div id='footer-push'></div>
71
+ </div>
72
+ <div id='footer'>
73
+ <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
74
+ </div>
75
+ </body>
76
+ </html>
@@ -0,0 +1,234 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html lang='en'>
3
+ <head>
4
+ <title>File: README.rdoc [AssetHat]</title>
5
+ <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
6
+ <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
7
+ <script type='text/javascript'>
8
+ //<![CDATA[
9
+ function popupCode(url) {
10
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
11
+ }
12
+
13
+ function toggleCode(id) {
14
+ var code = document.getElementById(id)
15
+
16
+ code.style.display = code.style.display != 'block' ? 'block' : 'none'
17
+ return true
18
+ }
19
+
20
+ // Make codeblocks hidden by default
21
+ document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
22
+ //]]>
23
+ </script>
24
+ </head>
25
+ <body class='page'>
26
+ <div class='file' id='wrapper'>
27
+ <div class='header'>
28
+ <div class='name'>README.rdoc</div>
29
+ <div class='paths'>
30
+ README.rdoc
31
+ </div>
32
+ <div class='last-update'>
33
+ Last Update:
34
+ <span class='datetime'>Thu Jun 10 11:22:45 -0400 2010</span>
35
+ </div>
36
+ </div>
37
+ <div id='content'>
38
+ <div id='text'>
39
+ <div id='description'>
40
+ <h1><a href="../classes/AssetHat.html">AssetHat</a></h1>
41
+ <p>
42
+ Your assets are covered.
43
+ </p>
44
+ <p>
45
+ With Rails&#8217; default asset caching, CSS and JS are concatenated (not
46
+ even minified) the first time that bundle is requested. Not good enough. <a
47
+ href="../classes/AssetHat.html">AssetHat</a> can automatically:
48
+ </p>
49
+ <ul>
50
+ <li>Easily <b>minify</b> and <b>bundle</b> CSS and JS on deploy to reduce file
51
+ sizes and HTTP requests.
52
+
53
+ </li>
54
+ <li>Load popular <strong>third-party JS</strong> (like jQuery and Prototype)
55
+ from <a href="http://code.google.com/apis/ajaxlibs/"><strong>Google's
56
+ CDN</strong></a> when in production, or from localhost in development.
57
+
58
+ </li>
59
+ <li>Force image URLs in your CSS to use <strong>CDN subdomains</strong>, not
60
+ just the current host.
61
+
62
+ </li>
63
+ <li>Add an image&#8217;s last <a href="http://git-scm.com/">Git</a> commit ID
64
+ to its CSS URLs to <strong>bust browser caches</strong> (e.g.,
65
+ <tt>/images/foo.png?ab12cd34e</tt>).
66
+
67
+ </li>
68
+ </ul>
69
+ <p>
70
+ After setup, you can use these in your layouts and views:
71
+ </p>
72
+ <pre>&lt;%= include_css :bundle =&gt; 'application' %&gt;&#x000A; # =&gt; &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;&#x000A;&lt;%= include_js :bundles =&gt; ['plugins', 'common'] %&gt;&#x000A; # =&gt; &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>
73
+ <p>
74
+ And this in your deploy script:
75
+ </p>
76
+ <pre>rake asset_hat:minify</pre>
77
+ <p>
78
+ Tested with Rails 2.3.x.
79
+ </p>
80
+ <h2>Installation</h2>
81
+ <ol>
82
+ <li>Install the gem:
83
+
84
+ <pre>gem install asset_hat</pre>
85
+ </li>
86
+ <li>Configure the gem:
87
+
88
+ <ul>
89
+ <li>If you&#8217;re using <a href="http://github.com/carlhuda/bundler">Bundler
90
+ 0.9+</a>:
91
+
92
+ <ol>
93
+ <li>Add to your app&#8217;s Gemfile: <tt>gem 'asset_hat', '0.x.x'</tt>
94
+
95
+ </li>
96
+ <li>Command-line: <tt>bundle install</tt>
97
+
98
+ </li>
99
+ </ol>
100
+ </li>
101
+ <li>If you&#8217;re using Rails&#8217; <tt>config.gem</tt>, add to your
102
+ app&#8217;s <tt>config/environment.rb</tt>:
103
+
104
+ <pre>config.gem 'asset_hat', :version =&gt; '0.x.x'</pre>
105
+ </li>
106
+ </ul>
107
+ </li>
108
+ <li>Add to your app&#8217;s Rakefile:
109
+
110
+ <pre>require 'asset_hat/tasks'</pre>
111
+ </li>
112
+ </ol>
113
+ <h2>Configuration</h2>
114
+ <ol>
115
+ <li>Create the default config file:
116
+
117
+ <pre>rake asset_hat:config</pre>
118
+ </li>
119
+ <li>In your app, open the new file at <tt>config/assets.yml</tt>, and set up
120
+ your CSS/JS bundles according to that file&#8217;s example.
121
+
122
+ </li>
123
+ <li>Minify your bundles:
124
+
125
+ <pre>rake asset_hat:minify</pre>
126
+ <p>
127
+ This minifies all of the CSS/JS files listed in <tt>config/assets.yml</tt>,
128
+ concatenates the minified code into bundle files, and adds CDN asset hosts
129
+ and cache-busting commit IDs to image URLs in your CSS.
130
+ </p>
131
+ <p>
132
+ Bundles are created as new files in <tt>public/stylesheets/bundles/</tt>
133
+ and <tt>public/javascripts/bundles/</tt>. Your original CSS/JS files remain
134
+ intact.
135
+ </p>
136
+ </li>
137
+ <li>Set your deployment script to run <tt>rake asset_hat:minify</tt> after
138
+ deploying your latest CSS/JS. This overwrites previously minified bundles,
139
+ and leaves your original CSS/JS files intact.
140
+
141
+ </li>
142
+ </ol>
143
+ <h3>Advanced configuration</h3>
144
+ <p>
145
+ If you manage deployments with <a
146
+ href="http://www.capify.org/">Capistrano</a>, see the gem&#8217;s packaged
147
+ example at <tt><a
148
+ href="lib/asset_hat/capistrano_rb.html">lib/asset_hat/capistrano.rb</a></tt>.
149
+ </p>
150
+ <p>
151
+ Additional settings are supported in <tt>config/assets.yml</tt>:
152
+ </p>
153
+ <ul>
154
+ <li><tt>engine</tt>: Indicates how CSS and JS are minified; omit this setting
155
+ to use the defaults. By default, CSS is minified with <a
156
+ href="http://github.com/rgrove/cssmin">rgrove/cssmin</a> (a Ruby port of
157
+ Lecomte&#8217;s YUI Compressor and Schlueter&#8217;s PHP cssmin), and JS is
158
+ minified with <a href="http://github.com/rgrove/jsmin">rgrove/jsmin</a> (a
159
+ Ruby port of Crockford&#8217;s JSMin).
160
+
161
+ <p>
162
+ If the default engines cause problems by minifying too strongly, try
163
+ switching each to <tt>weak</tt>. The <tt>weak</tt> engines are much safer,
164
+ but don&#8217;t save as many bytes.
165
+ </p>
166
+ </li>
167
+ <li><tt>vendors</tt>: Currently only allows for setting the jQuery version
168
+ number:
169
+
170
+ <pre>js:&#x000A; vendors:&#x000A; jquery:&#x000A; version: 1.4</pre>
171
+ <p>
172
+ In the future, this will be used for configuring the retrieval of other
173
+ third-party code.
174
+ </p>
175
+ </li>
176
+ </ul>
177
+ <h2>Usage</h2>
178
+ <p>
179
+ In your layouts and views, instead of these:
180
+ </p>
181
+ <pre>&lt;%= stylesheet_link_tag 'reset', 'application', 'clearfix',&#x000A; :media =&gt; 'screen,projection',&#x000A; :cache =&gt; 'bundles/application' %&gt;&#x000A;&lt;%= javascript_include_tag 'plugin-1', 'plugin-2', 'plugin-3',&#x000A; :cache =&gt; 'bundles/application' %&gt;</pre>
182
+ <p>
183
+ <strong>Use these:</strong>
184
+ </p>
185
+ <pre>&lt;%= include_css :bundle =&gt; 'application' %&gt;&#x000A;&lt;%= include_js :bundle =&gt; 'application' %&gt;</pre>
186
+ <p>
187
+ These turn into:
188
+ </p>
189
+ <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/bundles/application.min.js&quot;&#x000A; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;</pre>
190
+ <p>
191
+ Have an enormous app? You can integrate gradually, using <a
192
+ href="../classes/AssetHat.html">AssetHat</a> alongside Rails&#8217; default
193
+ asset caching.
194
+ </p>
195
+ <p>
196
+ If your environment has <tt>config.action_controller.perform_caching</tt>
197
+ set to <tt>true</tt> (e.g., in production), the layout/view will include
198
+ minified bundle files. Otherwise, the separate, unminified files will be
199
+ included, based on the bundle contents you define in
200
+ <tt>config/assets.yml</tt>.
201
+ </p>
202
+ <h3>Advanced usage</h3>
203
+ <p>
204
+ You can also include single files as expected:
205
+ </p>
206
+ <pre>&lt;%= include_css 'reset', 'application' %&gt;&#x000A;&lt;%= include_js 'plugin.min', 'application' %&gt;</pre>
207
+ <p>
208
+ Or include multiple bundles at once:
209
+ </p>
210
+ <pre>&lt;%= include_js :bundles =&gt; %w[plugins common] %&gt;</pre>
211
+ <p>
212
+ When including multiple bundles at once, this yields one
213
+ <tt>&lt;link&gt;</tt> or <tt>&lt;script&gt;</tt> element per bundle.
214
+ </p>
215
+ <p>
216
+ You may want to use multiple bundles to separate plugins (rarely changed)
217
+ from application code (frequently changed). If all code is in one huge
218
+ bundle, then whenever there&#8217;s a change, browsers have to re-download
219
+ the whole bundle. By using multiple bundles based on change frequency,
220
+ browsers cache the rarely changed code, and only re-download the frequently
221
+ changed code.
222
+ </p>
223
+ </div>
224
+ <div id='section'>
225
+ </div>
226
+ </div>
227
+ </div>
228
+ <div id='footer-push'></div>
229
+ </div>
230
+ <div id='footer'>
231
+ <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
232
+ </div>
233
+ </body>
234
+ </html>