Closed webpro closed 10 years ago
You can use the dontAddFileExt config option for this:
curl.config({
dontAddFileExt: /\.js$/
});
https://github.com/cujojs/curl/wiki/Configuring-curl.js#curljss-common-configuration-options
But I want it to add the extension (the default behavior).
Silly me. Will this work?
curl.config({
dontAddFileExt: /\.js\//
});
Yes, that works, thanks. But shouldn't adding .js
if not matching /\.js$/
be the default behavior?
I had that originally, but people complained when using a module-locator service like the following:
paths: { foo: 'getModuleService?version=3.1.1' } // shouldn't add ".js"
But people are also doing this:
paths: { foo: 'foo.js.minified' } // should add ".js"
So now it uses this by default: /\?|\.js\b/ // don't add .js if there are query params or a ".js" anywhere
Maybe this is the best thing? /\?|\.js\// // don't add .js if it's part of a path
-- J
I understand the issues from your/curl's perspective. Imho, I think that your very first suggestion should be the default behavior. Thanks for clarifying.
When a directory contains
.js
in apaths
config, curl is not adding the.js
to the end of the path anymore. E.g.:And curl tries to fetch
lib/postal.js/lib/postal
(instead oflib/postal.js/lib/postal.js
).