cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

Path transformation not supported in Package declaration? #192

Closed CNSKnight closed 10 years ago

CNSKnight commented 11 years ago
var config = {
        // a string describing where the root of your javascript files resides. If this is a relative path, it is relative to the page.'
        baseUrl: '//localhost:jorge/myCore-dev',
        // a "hashmap" of path translations. See the Understanding Paths page for more details.'
        paths: {
            googleapis: '//ajax.googleapis.com/ajax/libs',
            myCore: 'templates',
            admin: 'jorge/templates',
            ANCILLARIES: 'modules/ANCILLARIES',
            curl: 'modules/ANCILLARIES/curl-0.6/src/curl'
        },
        // an array of package definitions. For more information about packages, see the Understanding Packages page.'
        packages: [
            {
                paths: {
                    myCore: 'templates',
                },
                name: 'myCoreFCore',
                location: 'myCore',
                main: 'js/myCoreF-main.source',
                // config options specific to myCore
                config: {}
            },
            {
                name: 'ADMINCore',
                //location: 'admin',
                main: 'admin/js/ADMIN-main.source',
                // config options specific to ADMIN
                config: {}
            }
        ],
        ...
};

Then asking for package ['myCore'] always resolves to http://localhost:jorge/myCore-dev/myCore/js/myCoreF-main.source.js

unscriptable commented 10 years ago

Hey @CNSKnight,

I have no idea how I missed this issue for so long. Sorry about that.

Here's the syntax that should work (paths moved into package config:

        packages: [
            {
                name: 'myCoreFCore',
                location: 'myCore',
                main: 'js/myCoreF-main.source',
                // config options specific to myCore
                config: {
                    paths: {
                        myCore: 'templates',
                    }
                }
            },

Let me know if this doesn't work.

Thanks!

-- John

CNSKnight commented 10 years ago

Sorry John, No go.

I did a [$ git pull origin] up to 0.8.1 and then config'd as templated above, but no load.

I did an error saying the //path/to/package.js failed to load. it's showing the location ! translated to the path defined in the package-specific config.

Meantime, I had originally expected the package to look up in the base config's paths for it's tokens if it didn't have any overrides?

Best,

Steeve