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

dontAddFileExt option not work with js! plugin #162

Closed lorenzocostalunga closed 10 years ago

lorenzocostalunga commented 11 years ago

workaround: at line 137 of js plugin:

// url = nameWithExt(require'toUrl', 'js'); /// LORENZO url = require'toUrl';

if (!config.dontAddFileExt.test(url)) url = nameWithExt(url, 'js');

sorry for my bad english

asilvas commented 11 years ago

I didn't think "dontAddFileExt" was suppose to apply to non-AMD modules? Plugins should control their own behavior.

The "js!" plugin should not be adding an extension...

unscriptable commented 11 years ago

Is there any reason why we can't allow plugins to use this config option?

@lorenzocostalunga: what is your use case? Can you describe the situation?

lorenzocostalunga commented 11 years ago

I need to load scripts and css combined (see MVC4 Bundling: http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification).

scripts: /bundles/jquery /bundles/jqueryUI /bundles/jqueryWithUI /bundles/modernizr /bundles/base

css: /bundles/jQueryUI/themes/baseAll /bundles/themes/base/css /bundles/css

use:

curl={ baseUrl:'/scripts/', dontAddFileExt:'.bundles/.', paths:{'link!':'/css/'} .... };

curl( [ 'js!/bundles/base!order', 'js!/bundles/myGrid!order', 'js!/bundles/pageScripts', 'js!/Scripts/myScript.js!order', 'css!/bundles/css', 'css!/css/page.css' ..... ] ).next(pageModules).then ....

thanks