Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated README

git-svn-id: http://bundle-fu.googlecode.com/svn/trunk@8 1db77ec0-6337-0410-9320-454da9aca44f
  • Loading branch information...
commit ff1183c22c77f5fba5f1385c8d345ac4f3879bc6 1 parent 621f5de
timcharper authored
Showing with 43 additions and 9 deletions.
  1. +43 −9 README
View
52 README
@@ -6,10 +6,14 @@ exponentially by simply combining all your css/js files into one file each.
Bundle_fu makes it easy to do. It's as easy as 1, 2!
-Step 1:
+----------------------------------------------------
+USAGE / INSTALLATION
+----------------------------------------------------
+
+=== Step 1 ===
Install this plugin
-Step 2:
+=== Step 2 ===
Put the following around your stylesheets/javascripts (note it works with any method of including assets!):
<% bundle do %>
@@ -21,26 +25,56 @@ Put the following around your stylesheets/javascripts (note it works with any me
That's it!
-Gotchas:
+----------------------------------------------------
+GOTCHAS
+----------------------------------------------------
+
* All content inside of bundle do will be replaced with a single js and css include statement. Any other content will be lost. Be sure to only put css / js includes inside of the block.
- * Scripts / stylesheets are detected by parseing the output and looking for include files. Comments are ignored, so if you comment out a stylesheet like this:
+ * Scripts / stylesheets are detected by parsing the output and looking for include files. Comments are ignored, so if you comment out a stylesheet like this:
<% bundle do %>
<%= javascript_include_tag "prototype" %>
- <!-- <%= stylesheet_link_tag "basic.css" %> -->
+ <!-- <%= stylesheet_link_tag "basic" %> -->
<%= calendar_date_select_includes params[:style] %>
<script src="javascripts/application.js" type="text/javascript"></script>
<% end %>
- The comment will be ignored and the css file will be bundled anyways. If you need to comment out a css file to perform an ie6 hack, put it outside the bundle block.
+ The comment will be ignored and the css file will be bundled anyways. If you need to comment out
+ a css file to perform an ie6 hack, put it outside the bundle block.
<% bundle do %>
<%= javascript_include_tag :defaults %>
- <%= stylesheet_link_tag "basic.css" %>
+ <%= stylesheet_link_tag "basic" %>
<% end %>
-
+ <!--[if lt IE 7.]>
+ <%= stylesheet_link_tag "ie6fix" %>
+ <![endif]-->
(it shouldn't be bundled anyways, since it's conditionally loaded)
-
+ * Relative paths in CSS may be disrupted.
+ If you're css depends on relative paths, they may be disrupted since they will be loaded likely
+ from a different directory. You can solve this by changing the directory a bundle is loaded from.
+ <% bundle :css_path => "/stylesheets/", :js_path => "/javascripts/" do %>
+ <%= javascript_include_tag :defaults %>
+ <%= stylesheet_link_tag "basic" %>
+ <% end %>
+
+ * Conditionally loaded css files and javascript files gotcha:
+ Consider the following
+ <% bundle do %>
+ <%= javascript_include_tag :defaults %>
+ <%= stylesheet_link_tag "#{@theme || 'blue'}_color_scheme" %>
+ <% end %>
+
+ On development, this will work fine. The bundle.css file will be regenerated everytime the theme changes.
+ However, on production, this will be effectively ignored, as the content is only regenerated once per
+ server instance. To remedy this, change the name parameter:
+ <% bundle :name => "bundle_#{@theme || 'blue'}" do %>
+ <%= javascript_include_tag :defaults %>
+ <%= stylesheet_link_tag "#{@theme || 'blue'}_color_scheme" %>
+ <% end %>
+
+ bundle_fu will generate a different bundle file for each instance of @theme, only once!
+
Author:
Tim C. Harper - irb(main):001:0> ( 'tim_see_harperATgmail._see_om'.gsub('_see_', 'c').gsub('AT', '@') )
Please sign in to comment.
Something went wrong with that request. Please try again.