Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use 'noext' plugin with config "paths" #47

Open
Anthony-Mckale opened this issue Mar 10, 2014 · 0 comments
Open

Unable to use 'noext' plugin with config "paths" #47

Anthony-Mckale opened this issue Mar 10, 2014 · 0 comments

Comments

@Anthony-Mckale
Copy link

Hi

first thanks your our excellent plugins

had a wee issue with aliased modules e.g. with explicit paths

requirejs.config({
    paths: {
        "noext": '../../shared/js/requirejs/plugins/0.3.2/noext',
        "dynamicstripconfig": "../php/domain/config.php"
    }
});

It was breaking the "toUrl" translation between "dynamicstripconfig" to "../php/domain/config.php" inside requirejs

Rewrote "noext" so it now wait till the "load" instead of the "normalize" to inject the query string to interrupt the ".js" postfixing

New noext.js ->

/** @license
 * RequireJS plugin for loading files without adding the JS extension, useful for
 * JSONP services and any other kind of resource that already contain a file
 * extension or that shouldn't have one (like dynamic scripts).
 * Author: Miller Medeiros (0 - 0.3.1)
 * Author: Anthony Mckale (0.3.2)
 * Version: 0.3.2 (2014/03/10)
 * 0.3.2 - Moved parameter add to load, so we could use paths with this extension 
 * 
 * Released under the MIT license
 */
define(function(){
var QUERY_PARAM = 'noext';

//API
return {
    load : function(name, req, onLoad, config) {
        var rawrequireurl = req.toUrl(name);
        rawrequireurl += (rawrequireurl.indexOf('?') < 0)? '?' : '&';
        rawrequireurl += QUERY_PARAM +'=1';
        req([rawrequireurl], function(mod){
            onLoad(mod);
        });
    },
    normalize : function(name, norm){
        return name;
    }

};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant