Given a project with the files below and a directory structure as follows:
$ tree --charset ascii
.
|-- index.html
|-- js
| |-- components
| | `-- vendor
| | |-- jquery-1.7.2.js
| | |-- jquery.js
| | `-- test.js
| |-- order.js
| `-- require.js
`-- nested
`-- path
`-- index.html -> ../../index.html
5 directories, 7 files
Note that the file names are below, but the directory structure is not preserved
since github gist's don't allow subduers. The directory is served statically
(using something like python -m SimpleHTTPServer
), with the require.js
config
set with baseUrl: '/js'
and the following URLs are visited:
http://127.0.0.1:8000/
http://127.0.0.1:8000/nested/path/
Here the page load works, but there are two gotchas:
Does this mean it will load incorrectly (baseUrl/b.js is wrong)? My guess is that you meant there's a double mapping, first from b to c, then from c to the base url.
James, if I'm correct in this, why can't the global require still load relative paths? For steal, we assume paths without any prefix [/, ./, etc] are relative to the base url. Isn't requirejs the same way? For example, no matter where I am:
always does baseUrl/jquery.js.
require(['jquery'])
will always look in the baseUrl?Thanks!