title: Rails Variables inside the CSS file
body: <p>I have CSS file that needs to be embedded by the user. Now for the user to customize the CSS file as he/she wishes (change the colors and font-size mainly) I have to store that information in database file, append that information to specfic CSS file and then enable that user to embed it. </p>
  
  <p>I would get the id of the User that I wish to change. So color codes stored are basically extracted from, </p>
  
  <pre><code>User.find(params[:id]).main_color 
  # This would return =&gt; #fffff 
  </code></pre>
  
  <p>This what my embed code looks like right now, </p>
  
  <pre><code>&lt;link href="link.com/initial.css" type="text/css" rel="stylesheet" /&gt; 
  &lt;script type="text/javascript" data-user="18" src="link.com/some_file.js" /&gt;
  </code></pre>
  
  <p>Here data-user is the id of the user who is modifying the CSS file. (The IFrame is being embedded using the javascript file)</p>
  
  <p>How should I modify my embed code and fetch the custom variables from my database in order to make the CSS cstomizable as the user wants? </p>
  
  <p>Thanks in advance. </p>
  
  <p>P.S I have thought of rewriting the CSS in the view(.html.erb file) and using !important there along with proper color codes selected by the user but that approach is not exactly very efficient.</p>