Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6189627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:26:45+00:00 2026-05-24T02:26:45+00:00

I am using nifty layout from Ryan Bates and that includes Layout helper with

  • 0

I am using nifty layout from Ryan Bates and that includes Layout helper with following code.

in my application.html.erb

<%= stylesheet_link_tag "application", :cache => true %>
<%= javascript_include_tag :defaults, :cache => true %>
<%= yield(:head) %>

Then in the helper layout_helper.rb

def stylesheet(*args)
  content_for(:head) { stylesheet_link_tag(*args) }
end
def javascript(*args)
  content_for(:head) { javascript_include_tag(*args) }
end

using this in my application i can add css and javascript from any page simply by calling

<% javascript "what_ever" %>
<% stylesheet "what_ever" %>

but the problem i am facing is that these extra css or js files do not get the :cache => true and thus will not be cached.

Is there a way to resolve this?

Basically I want to have small small css files for each page and then serve one big file when it is called.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:26:46+00:00Added an answer on May 24, 2026 at 2:26 am

    Did some digging on the net about this.

    There are pros and cons for doing the small small files. So the jury is still out.

    One site said the small small files help readability so better to use them but then use some programming language to combine all the css files and server them as one.

    the benifit of this is that you can still develop the way you prefer but the user only needs to download the file once and does not have to make the calls for each new file.

    Taking this approach, the best solution will be to divide each file and match it to the model name. The application.css contains css common to all pages, where as the modelname.css file contains items specific to that model.

    then in application.html.erb, you make the call as such.

    <%= stylesheet_link_tag :all, :cache => true %>
    

    This will combine all the css files and serve them as one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Ryan Bates' nifty authentication in my application for user signup and login.
I'm using Ryan Bates's nifty:authentication , and starting testing with Rspec. Fought with this
I found a nifty RegEx function that I'm using (see below). The function outputs
The Problem I have a very nifty menu Html helper written for WebFormViewEngine views.
I'm following this article ( http://asciicasts.com/episodes/160-authlogic ), I'm not using nifty generator tho. I've
I am using the following code to perform a selector after a delay with
Much like this question , I too am using Ryan Bates's nifty_scaffold. It has
I've been using this nifty LINQ to SQL tool for a data access layer
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.