Permalink
Browse files

less intrusive autoconfig - fix #260

  • Loading branch information...
1 parent 0fca834 commit fd90dc775b2d4e7cf1bb62126a6ad754d30e392c @jeromeetienne committed Mar 5, 2013
Showing with 10 additions and 5 deletions.
  1. +10 −5 plugins/requirejs/footer.js
@@ -1,9 +1,14 @@
(function(){
+ // get the script dom element which included the library
var scripts = document.getElementsByTagName('script');
- var element = scripts[scripts.length-1];
- var baseUrl = element.getAttribute('data-baseURL');
- console.log('baseUrl', baseUrl, element);
- if( baseUrl === null ) return;
+ var scriptEl = scripts[scripts.length-1];
+ var src = scriptEl.src;
+ var suffix = '/build/tquery-bundle-require.js';
+ // if the element src DOES NOT endup with suffix, do nothing
+ if(src.indexOf(suffix, src.length - suffix.length) !== -1) return;
+ // get the baseURL
+ var baseURL = src.substr(0, src.length - suffix.length)
+ // configure require.js using this baseUrl
requirejs.config({
paths : {
"build" : baseUrl+'/build',
@@ -12,4 +17,4 @@
"three.js" : baseUrl+'/vendor/three.js',
},
});
-})()
+})();

0 comments on commit fd90dc7

Please sign in to comment.