title: Access JavaScript variable in CSS
body: <p>Below is the code for reference. Value for variable 'imgpath' is changed on load. I need to assign this new value for background image of class 'icon1'. 
  I know this can be done using JavaScript/jQuery, but I need some way to do update this value in CSS itself.
  Can it be possible using Sass/Less or any other way?</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
      &lt;style&gt;
      .icon1 {
          background: transparent url("imagepath1/icon1.png") no-repeat center center;
      &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;a class="icon1"&gt;&lt;/a&gt;
      &lt;script&gt;
      var imgpath = "imagepath1";
      if (setnewpath)
          imgpath = "imagepath2";
      &lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Thank you for any help!</p>