caolan/jam — pull request #119 by wesleytodd (2012-12-24 01:37:57+00:00)
Title: Absolute script uri's

This is my first time working with Jam, and I am fairly new with require, so sorry if this is a totally noob problem/non-problem.

I was hoping to roll Jam it into an Express.js app I am working on. Maybe there is something for this that I am totally missing, but I saw [this issue](https://github.com/caolan/jam/issues/84) and think this would solve both problems. My `package.json` looked like this:

"jam": {
"packageDir": "public/js/lib",
"baseUrl": "public/js",
"dependencies": {
"jquery": "1.8.3"
}
}

After building the require config files, this is what they looked like:

require.config({
"packages": [
{
"name": "jquery",
"location": "lib/jquery",
"main": "dist/jquery.js"
}
],
"shim": {}
});

Notice the `"location" : "lib/jquery"`. What I wanted this to be was `/js/lib/jquery`.

This change adds an option `locationBase` (might not be the best name...), which is then appended to the location, resulting in:

// package.json
"jam": {
"packageDir": "public/js/lib",
"baseUrl": "public/js",
"locationBase": "/js",
"dependencies": {
"jquery": "1.8.3"
}
}

// require.js
require.config({
"packages": [
{
"name": "jquery",
"location": "/js/lib/jquery",
"main": "dist/jquery.js"
}
],
"shim": {}
});

I setup the tests and ran them after making the change and only got one failure:

![jam-tests](https://f.cloud.github.com/assets/1027776/29374/562a499a-4d6a-11e2-973d-6d21f161c6bf.png)

I dont think that has anything to do with the changes, but let me know if I am wrong...

Anyway, good work on the package manager!!