Last active
August 29, 2015 13:56
-
-
Save ptb/8869024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['jquery'], function (jquery) { | |
return jquery.noConflict(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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