Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Drupal.settings.basePath in Modernizer / yepnope.js loads
    primarykey
    data
    text
    <p>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..</p> <pre><code>Modernizr.load([ { test: Modernizr.mq('only all'), nope: '/sitename/docroot/sites/all/themes/theme/js/libs/polyfill.js' }, .... </code></pre> <p>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.</p> <p><a href="http://mysite.devcloud.acquia-sites.com/mysite/docroot/sites/all/themes/theme/js/libs/polyfill.js">http://mysite.devcloud.acquia-sites.com/mysite/docroot/sites/all/themes/theme/js/libs/polyfill.js</a></p> <p>It needs to be the below, without the mysite/docroot in the URL.</p> <p><a href="http://mysite.devcloud.acquia-sites.com/sites/all/themes/theme/js/libs/polyfill.js">http://mysite.devcloud.acquia-sites.com/sites/all/themes/theme/js/libs/polyfill.js</a></p> <p>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 / ). </p> <p>So me being the amateur assumed I could do something like this.. (forgive the poor sample, I know it can be done better)</p> <pre><code>var myroot = Drupal.settings.basePath Modernizr.load([ { test: Modernizr.mq('only all'), nope: myroot + 'sites/all/themes/theme/js/libs/polyfill.js' }, .... </code></pre> <p>And this of course does not work. Just returns query1 is not defined.</p> <p>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.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload