callumlocke / grunt-cdnify

Grunt plugin for finding and modifying static resource URLs
61 stars 40 forks source link

if no protocol will appear js undefined #8

Closed ghost closed 9 years ago

ghost commented 10 years ago
cdnify.js line 26

function joinBaseAndPath(base, urlPath) {
  // Split out protocol first, to avoid '//' getting normalized to '/'
  var bits = base.split('//'),
      protocol = bits[0], rest = bits[1];

  if (!rest) {
    protocol = null;
    rest = bits[0];
  }

  // Trim any path off if this is a domain-relative URL
  if (urlPath[0] === '/')
    rest = rest.split('/')[0];

  // Join it all together
  return (protocol ? protocol + '//' : '') + path.normalize("" + rest + "/" + urlPath);
}
XhmikosR commented 9 years ago

Can you elaborate what's wrong?

XhmikosR commented 9 years ago

This no longer applies to the latest version.