title: Rails Asset Pipeline With Themes
body: <p>I have an application that allows users to choose a theme for their page.  There are several different themes for them to choose from.</p>
  
  <p>The HTML structure to each of the pages is exactly the same with the same class names on divs.  The CSS varies to fill out the theme.  When the user chooses a theme, I store the theme id in the database and query for it when the page is accessed, loading the appropriate CSS file in the  of <code>application_layout.html.erb</code>:</p>
  
  <pre><code>&lt;%= yield(:theme_style) %&gt;
  </code></pre>
  
  <p>On <code>users_page.html.erb</code>, I grab the appropriate file with:</p>
  
  <pre><code>&lt;%= provide(:theme_style, "theme_styles/#{@user.style.style_filename_file_name}") %&gt;
  </code></pre>
  
  <p>Because the page structure doesn't change, it is important that the CSS files aren't compiled together in one big CSS file or else the last theme will be the only one available because it will overwrite all previous styles.  How can I get Rails to handle the theme files?</p>
  
  <p>In <code>production.rb</code>, I have <code>config.assets.precompile += ['theme_styles/basic.css', 'theme_styles/two-column.css']</code> but that doesn't seem to do the trick as it tells me that it is not precompiled.</p>
  
  <p>I can't seem to find enough information anywhere to put me in the right direction and I've looked over blogs, SO questions and the Rails documentation.</p>