adamh-asset_library 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -19,25 +19,29 @@ Finally, include the Rake tasks in your project:
19
19
 
20
20
  == Usage
21
21
 
22
- Two methods are made available for your views:
22
+ In your Rails project, edit <tt>config/asset_library.yml</tt> as described
23
+ in the following section.
23
24
 
24
- <% # outputs library.js (production) or its files (development) %>
25
- <%= asset_library_javascript_tags(:library) %>
25
+ Once configured, asset_library provides two helper methods for your views:
26
26
 
27
- <% # outputs library.css (production) or its files (development) %>
28
- <%= asset_library_stylesheet_tags(:library) %>
27
+ <%# outputs library.js (production) or its files (development) %>
28
+ <%= asset_library_javascript_tags(:javascripts) %>
29
29
 
30
- <% # outputs library.ie6.css (production) or its files (development) %>
30
+ <%# outputs library.css (production) or its files (development) %>
31
+ <%= asset_library_stylesheet_tags(:stylesheets) %>
32
+
33
+ <%# outputs library.ie6.css (production) or its files (development) %>
31
34
  <!--[if lte IE 6]>
32
- <%= asset_library_stylesheet_tags(:library, 'ie6') %>
35
+ <%= asset_library_stylesheet_tags(:stylesheets, 'ie6') %>
33
36
  <![endif]-->
34
37
 
35
38
  Both helpers behave differently depending on whether
36
- <tt>ActionController::Base.perform_caching</tt> is true (that is, whether you are in
37
- <tt>development</tt> environment or not). When caching is disabled, each file in the
38
- module will be included. (Internet Explorer only allows 30 <tt>style</tt> and <tt>link</tt>
39
- stylesheet tags; in development mode, <tt>import</tt> rules are used to work around
40
- the bug.) When caching is enabled, a single tag is output.
39
+ <tt>ActionController::Base.perform_caching</tt> is true (that is, whether you
40
+ are in <tt>development</tt> environment or not). When caching is disabled, each
41
+ file in the module will be included. (Internet Explorer only allows 30
42
+ <tt>style</tt> and <tt>link</tt> stylesheet tags; in development mode,
43
+ <tt>import</tt> rules are used to work around the bug.) When caching is
44
+ enabled, a single tag is output.
41
45
 
42
46
  When caching is enabled, the modules to include must be generated using:
43
47
 
@@ -51,7 +55,8 @@ A cached module is simply the concatenation of its constituent files.
51
55
 
52
56
  == Configuration
53
57
 
54
- A typical configuration (Yaml) file might look like this:
58
+ A typical configuration (Yaml) file might look like this. In Rails, this
59
+ should be in <tt>config/asset_library.yml</tt>.
55
60
 
56
61
  javascripts:
57
62
  cache: library
@@ -24,6 +24,8 @@ class AssetLibrary
24
24
 
25
25
  def timestamp
26
26
  File.mtime(absolute_path)
27
+ rescue Errno::ENOENT
28
+ nil
27
29
  end
28
30
 
29
31
  def relative_url
@@ -29,7 +29,11 @@ class AssetLibrary
29
29
  end
30
30
 
31
31
  def import_styles_tag(urls)
32
- urls.enum_slice(30).collect{ |subset| import_style_tag(subset) }.join("\n")
32
+ a = []
33
+ urls.each_slice(30) do |subset|
34
+ a << import_style_tag(subset)
35
+ end
36
+ a.join("\n")
33
37
  end
34
38
 
35
39
  def import_style_tag(urls)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adamh-asset_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - adamh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-16 00:00:00 -07:00
12
+ date: 2009-07-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15