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 6750829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:51:17+00:00 2026-05-26T12:51:17+00:00

We have 3 possible options: user not signed in user signed in user signed

  • 0

We have 3 possible options:

  • user not signed in
  • user signed in
  • user signed in as admin

Since our user area is significantly heavier (in terms of css), I would like to spare people that are not signed in to load the code.

Is it possible to change my css.scss to css.scss.erb & then add some helpers? For example:

Application.css.scss.erb

  # include css files for non-logged in users
  <% if signed_in? %>
    # include css files for logged in users
    <% if current_user.try(:staff_role?) %>
      # include css files for admin users
    <% end %>
  <% end %>

This way, I prevent adding a second or a third http request for the user. Effective?

How would this affect rendering times? Would rails cache 3 different files?

  • 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-26T12:51:17+00:00Added an answer on May 26, 2026 at 12:51 pm

    I don’t think this will work very well. All your assets will get pre-compiled in production so your ERB won’t do what you’re expecting it to do. Any ERB in your assets needs to be “environment level” only and by that I mean things like paths that don’t depend on the current request’s state at all. You can use multiple style sheets though:

    • One that covers all the common stuff.
    • One that contains things for logged-in users (but the content cannot depend on which user is logged in).
    • One for admin users (but again, the content cannot depend on which user is logged in).

    Then you include the appropriate style sheet in your views.

    If for some reason you need per-user CSS then you’ll have to use <style> elements in your views and inline it or serve the CSS through a controller so that you can reliably customize it on a per-request basis.

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

Sidebar

Related Questions

I have found possible slowdown in my app so I would have two questions:
Is it possible to have a <div> simultaneously (1) not take up all available
I would like to have a textbox in a Silverlight app where the user
I have a multiple user/location RCP application that currently utilizes several user configurable options.
I have multi-select drop down list where in user can select multiple options, now
I have tried all the possible options to use openID delegation on my site,
I have an application that sends data based on user interaction (not user input).
I have a need to present a user with various editing options when they
I'm not sure if this is possible or not. I have created a ComboBox
I have a little web admin tool I'm working on that allows a user

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.