Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Absolute base URL #143

Open
BrianHicks opened this issue May 7, 2013 · 1 comment
Open

Absolute base URL #143

BrianHicks opened this issue May 7, 2013 · 1 comment

Comments

@BrianHicks
Copy link

(disclaimer: I'm a bit new to both Jam and require, trying to figure this out for the first time.)

I'm using Jam with Django. Right now, here's the relevant bits of my package.json:

{
    "jam": {
        "packageDir": "assets",
        "baseUrl": "static",
        "dependencies": {
            "bootstrap": "2.3.1",
            "jquery": "2.0.0",
            "angularjs": "1.0.5",
            "angular-resource": "1.0.1"
        }
    }
}

This makes Jam calculate the paths of the assets as (for example) ../assets/angularjs. What I expected (and in fact need here) is for the path to look like /static/angularjs. (The reasons for this are slightly wonky. Django handles static files by copying them from a different directory in production, and serving them as if they were already copied in development.)

If it's not possible in some way to change this, is there a flag I can set to have Jam leave my require.js and require.config.js alone on installs so I can set the paths manually?

@Jae
Copy link

Jae commented Jun 2, 2013

the module managed by Jam needs to be accessible via url as it's loaded asynchronously by require.js. without changing Jam what you could do is to have packageDir to be "assets/static" and baseUrl to be "assets" which will generate your paths to be "static/angularjs". Then in your app.js you could set the baseUrl to be '/' which will give you the right path "/static/angularjs". obviously you would need to have something setup during development to serve "/static/angularjs" from "assets/static/angularjs". you can compile it everything into one js file for production via build pipeline.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants