Using Drupal.settings.basePath in Modernizer / yepnope.js loads I am currently starting development of drupal sites on Acquia. Using git and working locally is a new workflow for me. When building locally and trying to utilize  Modernizr load / yepnope, my JS in my script.js file typically looks like this..

Modernizr.load([
    {
    test: Modernizr.mq('only all'),
    nope: '/sitename/docroot/sites/all/themes/theme/js/libs/polyfill.js'
    },
    ....


So that works locally on my machine, but when I commit my changes and push to my acquia development server the file path for the loaded scripts is incorrect, since it's not the same setup I guess.

http://mysite.devcloud.acquia-sites.com/mysite/docroot/sites/all/themes/theme/js/libs/polyfill.js

It needs to be the below, without the mysite/docroot in the URL.

http://mysite.devcloud.acquia-sites.com/sites/all/themes/theme/js/libs/polyfill.js

So that brings me to Drupal.settings.basePath. If I print this out it gives me /mysite/docroot/ on my local setup. If I do it on the dev server, it would print out something different (probably just / ). 

So me being the amateur assumed I could do something like this.. (forgive the poor sample, I know it can be done better)

var myroot = Drupal.settings.basePath

Modernizr.load([
{
test: Modernizr.mq('only all'),
nope: myroot + 'sites/all/themes/theme/js/libs/polyfill.js'
},
....


And this of course does not work. Just returns query1 is not defined.

So I am sure there are faults in many of my attempts to make this work.. so if anyone can suggest something to me, either workflow related or how to fix my setup / code, that would be great.

Thanks
Your local environment seems to be misconfigured. If you're running apache with vhosts then your VirtualHost definition should look like this:

&lt;VirtualHost *:80&gt;
  ServerName whatever-you-choose-for-a-dev-domain.com
  DocumentRoot "/path/to/the/drupal/root/directory"
&lt;/VirtualHost&gt;


Where the DocumentRoot should also include /sitename/docroot 

Alternatively you may be able to edit .htaccess in the Drupal root directory to 
    RewriteBase /sitename/docroot
Which there should already be a commented definition of RewriteBase in there that you simply would uncomment. But I think the VirtualHost path would be the best one.