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

async plugin should support paths/map configs #15

Open
millermedeiros opened this issue Dec 28, 2012 · 3 comments
Open

async plugin should support paths/map configs #15

millermedeiros opened this issue Dec 28, 2012 · 3 comments

Comments

@millermedeiros
Copy link
Owner

was asked here: http://blog.millermedeiros.com/requirejs-2-0-delayed-module-evaluation-and-google-maps/#comment-89531

@andyscott12
Copy link

awesome plugin - would love to see support for something like

paths: {
async: '/libs/require.async'      
gmaps: 'http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false'
},
shim: {
   gmaps: ['async']
}

or something which allows like

define([
"jquery",
"backbone",
"async!gmaps"
])

etc

@millermedeiros
Copy link
Owner Author

@andyscott12 you can create an alias:

// convert Google Maps into an AMD module
define('gmaps', ['async!http://maps.google.com/maps/api/js?v=3&sensor=false'],
function(){
    // return the gmaps namespace for brevity
    return window.google.maps;
});

see this post for more info: http://blog.millermedeiros.com/requirejs-2-0-delayed-module-evaluation-and-google-maps/ -

@JulienCabanes
Copy link

Love your plugins. I also need to put paths alias for async modules. I'm working on a localized website with Bing Maps which need the locale in the URL. I thought the best way was a config.js for each locale:

// config-fr.js
requirejs.config({
  paths: {
    'bingmaps': '//ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=fr-fr'
  }
});

// my-module.js
define(['async!bingmaps!onscriptload'], function() {...})

Notice fr-fr at the end of the URL which I need to config.
Any thought how I could workaround this case ?
Thanks

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

No branches or pull requests

3 participants