Skip to content

Instantly share code, notes, and snippets.

@ptb
Last active August 29, 2015 13:56
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 ptb/8869024 to your computer and use it in GitHub Desktop.
Save ptb/8869024 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'/>
<title></title>
</head>
<body>
<div id='main'></div>
<script data-main='js/main.js' src='js/require.js'></script>
</body>
</html>
define(['jquery'], function (jquery) {
return jquery.noConflict();
});
requirejs.config({
baseURL: 'js',
map: {
'*': {
'jquery': 'jquery-noconflict',
},
'jquery-noconflict': {
'jquery': 'jquery'
}
},
paths: {
backbone: 'backbone-1.1.0',
jquery: [
'http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min',
'jquery-2.1.0'
],
// marionette: 'marionette-1.6.1',
marionette: 'marionette-amd-1.6.1',
underscore: 'underscore-1.5.2'
},
shim: {
'backbone': {
deps: ['underscore', 'jquery'],
exports: 'Backbone',
init: function () {
return this.Backbone.noConflict();
}
},
// 'marionette': {
// deps: ['backbone'],
// exports: 'Marionette'
// },
'underscore': {
exports: '_',
init: function () {
return this._.noConflict();
}
}
}
});
require(['backbone', 'jquery', 'marionette', 'underscore'], function(bb, jq, ma, un) {
try { console.log('local: jQuery version:', jq.fn.jquery); } catch (e) {}
try { console.log('global: jQuery version:', $.fn.jquery); } catch (e) {}
try { console.log('local: Underscore version:', un.VERSION); } catch (e) {}
try { console.log('global: Underscore version:', _.VERSION); } catch (e) {}
try { console.log('local: Backbone version:', bb.VERSION); } catch (e) {}
try { console.log('global: Backbone version:', Backbone.VERSION); } catch (e) {}
try { console.log('local: Marionette object:', ma); } catch (e) {}
try { console.log('global: Marionette object:', Marionette); } catch (e) {}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment