Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created December 1, 2014 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emiaj/8d1b05352860c7fc7040 to your computer and use it in GitHub Desktop.
Save emiaj/8d1b05352860c7fc7040 to your computer and use it in GitHub Desktop.
require.config({
paths: {
'rest': '/webjars/Rest/' + webjars.versions['Rest'],
'when': '/webjars/when-node/' + webjars.versions['when-node']
},
map: {
'rest': {
'when': 'when/when',
'when/lib':'when/lib'
}
}
});
// testing
require(["rest/browser","rest/interceptor/mime","rest/interceptor/errorCode"],function(rest,mime,errorCode){
var client = rest.wrap(mime).wrap(errorCode, {code:400});
client({ path: '/assets/json/data.json' }).then(
function(response) {
console.log('response: ', response);
},
function(response) {
console.error('response error: ', response);
}
);
});
require(["when/when"],function(when){
console.log(when);
});
<html>
....
<body>
....
<script>
@Html(org.webjars.RequireJS.getSetupJavaScript(routes.WebJarAssets.at("").url))
</script>
<script data-main="@routes.Assets.at("javascripts/main.js")"
src="@routes.WebJarAssets.at(WebJarAssets.locate("require.min.js"))"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment