#130 ✓resolved
Matias Korhonen

Use Rails built-in caching and bundling

Reported by Matias Korhonen | May 28th, 2009 @ 11:46 PM | in 0.5

Should we use the Rails built-in bundling and caching instead of Bundle Fu?

The only disadvantage I can see is that Rails doesn't have JS minification.

Rails API Examples ("Caching multiple stylesheets into one"):

  stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
    <link href="/stylesheets/style1.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/styleB.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/styleX2.css" media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
    <link href="/stylesheets/all.css"  media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is false =>
    <link href="/stylesheets/shop.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/cart.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/checkout.css" media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is true =>
    <link href="/stylesheets/payment.css"  media="screen" rel="stylesheet" type="text/css" />

Rails API Examples ("Caching multiple javascripts into one")

  stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
    <link href="/stylesheets/style1.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/styleB.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/styleX2.css" media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is true =>
    <link href="/stylesheets/all.css"  media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is false =>
    <link href="/stylesheets/shop.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/cart.css"  media="screen" rel="stylesheet" type="text/css" />
    <link href="/stylesheets/checkout.css" media="screen" rel="stylesheet" type="text/css" />

  stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment" # when ActionController::Base.perform_caching is true =>
    <link href="/stylesheets/payment.css"  media="screen" rel="stylesheet" type="text/css" />

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby on Rails web application for the HAAGA-HELIA Linux Club.

People watching this ticket

Referenced by

Pages