title: Can I change what path gets rendered when using bower in an yeoman angular app?
body: <p>I am using html5mode in my angular app, but when I run <code>bower install</code> with <code>grunt</code>, it renders the paths as</p>
  
  <p><code>&lt;script src="bower_components/...</code></p>
  
  <p>Can I change this to </p>
  
  <p><code>&lt;script src="/bower_components/...</code>?</p>
  
  <p>I've added a <code>&lt;base href="/"&gt;</code> tag to my <code>&lt;head/&gt;</code> section, but when my pages try to load javascript, they are still looking for relative urls.</p>
  
  <p>So for a script at <code>/bower_components/script.js</code>, currently rendered as
  <code>&lt;script src="bower_components/script.js"&gt;&lt;/script&gt;</code>,</p>
  
  <p>when on <code>/login</code>, the page tries to load <code>/login/bower_components/script.js</code></p>
  
  <p><strong>EDIT</strong>
  Following @sharpper's advice, I added the code block below and ended up with this in Gruntfile.js:</p>
  
  <pre><code>// Automatically inject Bower components into the app
  'bower-install': {
    app: {
      html: '&lt;%= yeoman.app %&gt;/index.html',
      ignorePath: '&lt;%= yeoman.app %&gt;/',
      fileTypes: {
        html: {
          block: /(([\s\t]*)&lt;!--\s*bower:*(\S*)\s*--&gt;)(\n|\r|.)*?(&lt;!--\s*endbower\s*--&gt;)/gi,
          detect: {
            js: /&lt;script.*src=['"](.+)['"]&gt;/gi,
            css: /&lt;link.*href=['"](.+)['"]/gi
          },
          replace: {
            js: '&lt;script src="/{{filePath}}"&gt;&lt;/script&gt;', // &lt;-- Change this line
            css: '&lt;link rel="/stylesheet" href="{{filePath}}" /&gt;'
          }
        },
        yml: {
          block: /(([\s\t]*)#\s*bower:*(\S*)\s*)(\n|\r|.)*?(#\s*endbower\s*)/gi,
          detect: {
            js: /-\s(.+)/gi,
            css: /-\s(.+)/gi
          },
          replace: {
            js: '- {{filePath}}',
            css: '- {{filePath}}'
          }
        }
      }
    }
  },
  </code></pre>
  
  <p>It still compiles correctly, but the files are rendered the same.</p>