title: Rails Precompiling Assets - Best Practice for responsive css
body: <p>These are the styles my page include (the top ones return get errors on production)    </p>
  
  <pre><code>&lt;link href="/assets/foundation.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/app.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/full_size.css" media="screen and (min-width: 761px)" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/mobile_size.css" media="screen and (max-width: 760px)"   rel="stylesheet" type="text/css" /&gt;
  
  &lt;link href="/assets/application-b0a44b2bbc0d3c94d855fbb830c2098d.css" media="screen" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="/assets/application-cd6a361c13ee838fceb09ecb2c58c467.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>My website is responsive so I want the styles to be included as they are needed based on the screen's size. Is there a way to precomplie my css separately so that it looks like this:</p>
  
  <pre><code>&lt;link href="/assets/foundation-b0a44b2bbc0d3c94d855fbb830c2098d.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/app-b0a44b2bbc0d3c94d855fbb830c2098d.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/full_size-b0a44b2bbc0d3c94d855fbb830c2098d.css" media="screen and (min-width: 761px)" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="/assets/mobile_size-b0a44b2bbc0d3c94d855fbb830c2098d.css" media="screen and (max-width: 760px)"   rel="stylesheet" type="text/css" /&gt;
  </code></pre>
  
  <p>Then there would be no need for application.css, also combining it all breaks my css. My website looked good in development :)</p>
  
  <p>for now ive set config.assets.enabled = false in the config/application.rb, would it be a better idea to compress the css and it include it manually on my own?</p>
  
  <p>This is somewhat similar to this question except I don't like any of the answers. Surely there is a simple solution to this.
  <a href="https://stackoverflow.com/questions/7134034/using-rails-3-1-assets-pipeline-to-conditionally-use-certain-css">Using Rails 3.1 assets pipeline to conditionally use certain css</a></p>