Skip to content

Ruby on Rails plugin - CSS/JS asset bundling in 10 seconds or less!

License

Notifications You must be signed in to change notification settings

kares/bundle-fu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bundle fu
-—————

Each css / js you load causes your site to load slower ! You can speed things
up 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 !

USAGE / INSTALLATION
-——————————-

Step 1

Install this plugin

script/plugin install git://github.com/kares/bundle-fu.git

Step 2

Put the following around your stylesheets/javascripts (note it works with any
method of including assets!):


  <% bundle do %>
    ...
    <%= javascript_include_tag "prototype" %>
    <%= stylesheet_link_tag "basic.css" %>
    <%= calendar_date_select_includes params[:style] %>
    <script src="javascripts/application.js" type="text/javascript"></script>
    ...
  <% end %>

That’s it!

Options

The <% bundle %> method accepts several options :

  1. :js_path defaults to "/javascripts/cache"
  2. :css_path defaults to "/stylesheets/cache"
  3. :name the bundle name set it if you have multiple bundle blocks
  4. :bypass if You want to skip the asset bundling, if its a Proc
    or symbol it will call/send it and use it’s outcome
  5. :packr_options if Packr is
    available (defined) it will use it for packing javascript files and pass the
    given options to it.

More Info

This Fork
-—————

This fork was created mainly to add support for asset id (timestamping) in CSS
url links. Bundle-fu by default rewrites (relative) CSS urls, it’s very useful
if these rewrites use the rails provided asset tag helpers, thus enjoying asset
cache busting with far future headers. This is exactly what this version does !

CSS Source



  #header {
    background-image: url(../images/header-bg.png) no-repeat scroll;
  }

  #footer .button {
    background-image: url("./images/button-bg.gif");
  }

Bundled CSS



  #header {
    background-image: url(/images/header-bg.png?1275245642) no-repeat scroll;
  }

  #footer .button {
    background-image: url(/stylesheets/images/button-bg.gif?1275842817);
  }

About

Ruby on Rails plugin - CSS/JS asset bundling in 10 seconds or less!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 96.9%
  • JavaScript 3.1%