Created
February 14, 2014 18:08
-
-
Save ryanramage/9005948 to your computer and use it in GitHub Desktop.
Use a minified require, fallback to unminified if not available
This file contains hidden or 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
<script type="text/javascript"> | |
function load(){ | |
require(['js/app', 'jquery'], function (app, $) { | |
window.$ = $; | |
app.initialize(); | |
require(['js/libs/bootstrap'], function(ihatebs){}) | |
}); | |
} | |
function loadDev(){ | |
console.log('DEVELOPMENT MODE'); | |
var script = document.createElement("script"); | |
script.src = 'jam/require.js'; | |
script.onload = load; | |
document.head.appendChild( script ); | |
} | |
</script> | |
<script src="jam/require.prod.js" onerror="loadDev()" onload="load()"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and the commands
to minify:
to 'unminify'