title: How to rewrite urls of images in vendor CSS files using Grunt
body: <p>I am trying to move frontend dependencies out of the version control system. A combination of Bower.io and Grunt should be able to do this.</p>
  
  <p>A problem however occurs that I am yet unable to solve with bundling multiple vendor libraries. For example assume I have the following directory structure where the <em>components</em> directory is the directory that Bower.io saves the dependencies in:</p>
  
  <pre><code>├── assets
  └── components
      ├── bootstrap
      │   ├── img
      │   │   └── glyhs.gif
      │   └── less
      │       └── bootstrap.css
      └── jquery-ui
          ├── css
          │   └── style.css
          └── images
              ├── next.gif
              └── prev.gif
  </code></pre>
  
  <p>Now assume I want to bundle both jQuery's <strong>style.css</strong> and Bootstrap' <strong>bootstrap.css</strong>. I will save this bundled file in <strong>assets/bundled.css</strong>. </p>
  
  <p>However in this file the references to the original images (../images/next.gif and ../img/glyhs.gif) are incorrect. They will have to be rewritten in order to work (so ../images/next.gif => ../components/jquery-ui/images/next.gif). I believe(d) this rewriting of URLs is something Grunt should be able to do. <strong>But I can not seem to get this to work using the cssmin/less/copy tasks</strong>. For example the following Grunt setup (only moving 1 file) fails to work:</p>
  
  <pre><code>module.exports = function (grunt) {
      grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),
          less: {
              options: {
                  compile: false,
                  relativeUrls: true
              },
              bootstrap: {
                  src: 'components/bootstrap/less/bootstrap.less',
                  dest: 'assets/bootstrap.css'
              }
          }
      });
      grunt.loadNpmTasks('grunt-contrib-less');
      grunt.registerTask('dist-css', ['less']);
  };
  </code></pre>
  
  <p>Either:</p>
  
  <ul>
  <li><p>Have I misconfigured Grunt or done something wrong? </p></li>
  <li><p>Or is the workflow I am describing simply not the right one and should I use another one instead.</p></li>
  </ul>
  
  <p>Thanks!</p>