title: Webpack, Scss - add cdn server path before compilation
body: <p>How do I add a cdn path variable into the styles.scss before compilation? I have a webpack 4 configuration that works fine for JS. The JS/CSS files are loaded correctly from the desired cdn url.  </p>
  
  <p>What I want to achieve is, that the project running on localhost will use a different cdn url for images/icons/fonts than the same web running on production.</p>
  
  <p>My webpack config has these lines for setting the cdn domain:</p>
  
  <pre><code>if (process.env.NODE_ENV === 'production') {
      webUrl = 'https://cdn.project.com/';
  }
  else if (process.env.NODE_ENV === 'development') {
      webUrl = 'http://localcdn.localhost/';
  }
  </code></pre>
  
  <p>This code works well for JS/CSS files, but CSS always loads backgrounds/fonts using a relative path, which of course is the main domain and not the cdn.</p>
  
  <p>Maybe just open the styles.scss and update the file manually before webpack compilation? Isn't there a better way?</p>