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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:38:45+00:00 2026-06-10T06:38:45+00:00

I have a Rails (3.1.3 with asset pipeline) application that will be deployed as

  • 0

I have a Rails (3.1.3 with asset pipeline) application that will be deployed as a war. This application has ui “themes”. Internally, I just have .scss files (Sass) in the assets directory of the Rails application and I let the user switch between them.

I’d like to allow administrators to add themes(basically .scss files) to the application after it has been deployed as a war. How can I allow the functionality without requiring the war be rebuilt/recompiled (using warbler). Ideally, they would be able to add themes without having to do anything with the war file.

I have a similar concern for language files. How can someone dynamically add a language file to a deployed Rails application?

I’m currently pre-compiling assets, namely the themes written using Sass, in production, but I’m open to changing this if it’ll helps solve this issue. Can I precompile asssets outside of the war? Is it possible to set the path of the asset pipeline to outside the war?

  • 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-06-10T06:38:47+00:00Added an answer on June 10, 2026 at 6:38 am

    Disclaimer: I’m not familiar with WAR at all. My answer may be completely wrong because I have no experience with it. Please understand that I found this to be an interesting challenge and I wanted to find a solution.

    I can’t tell if when you create a WAR archive what the application is capable of doing. As a result I decided to use command line to do the actual compiling. However, it shouldn’t be too difficult to include the sass gem and use the compiler directly if needed.

    Because I rely on the command line you have to install the sass gem. Then see the README on using the command line interface.

    For testing, I created a model called Theme with the following columns. You may need to change the code below to match the model you have in place.

    1. (string) title # the title of the theme
    2. (string) stylesheet_file_name # the name of the file that is saved

    Inside of my form I used a different field name to prevent overlapping.

    <%= f.form_field :styleheet %>
    

    Then inside of my controller I added the code to compile the uploaded scss file and move it into the public directory.

    def create
      if params[:theme].has_key?(:stylesheet)
    
        # create a filename friendly version of the theme name
        file_name = params[:theme][:stylesheet_file_name] = params[:theme][:title].parameterize
    
        # where to copy the temporary uploaded file to. It is important that we get
        # the original extension. The `sass` command uses the extension to determine how to compile the file
        tmp_file = "#{Rails.root}/tmp/#{params[:theme][:stylesheet].original_filename}"
    
        # move from /tmp path to within the Rails temp directory
        `cp #{params[:theme][:stylesheet].tempfile.path} #{tmp_file}`
    
        # create the theme's css file.
        File.open("#{Rails.root}/public/stylesheets/#{file_name}.css", 'w') do |f|
    
          # compile the .scss file via command line
          parsed_theme = `sass #{tmp_file}`
    
          # store the contents of the file
          f.write(parsed_theme)
        end
    
        # remove the temporary file we created earlier
        `rm #{tmp_file}`
    
        # this key wasn't part of my AR model
        params[:theme].delete("stylesheet")
      end
    
      # rest of action here ...
    end
    

    Once you have the css file in place you can include it in your layout/application.html.erb file with the following.

    <head>
      <%= stylesheet_link_tag "/stylesheets/#{@current_theme.stylesheet_file_name}" %>
    </head>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application in rails 3 that already has a polymorphic paperclip
I have a rails 3.2.6 app and I am using the asset pipeline and
I have a working rails 3.1 application that uses the mercury wysiwyg editor, however
I'm new to the Asset Pipeline, having just migrated over from Rails 3.0. I'm
I've deployed a Ruby on Rails app successfully and followed the asset pipeline guide
I have a Rails 3.1 project with the asset pipeline working great. The problem
I have Rails application with mounted Engine. #{main_app}/config/routes.rb mount CommentIt::Engine => /talk, :as =>
I have rails application running in linode server .Some guy is continuously spamming (writing
I just started using CakePHP for a small project. I have rails experience, and
Ok so, I'm getting this error when I try to use the asset pipeline.

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.