良い、
この例を見てください:
html
<!DOCTYPE html>
<html>
<head>
<title>My Sample Project</title>
<!-- data-main attribute tells require.js to load
scripts/main.js after require.js loads. -->
<script data-main="scripts/main" src="scripts/require.js"></script>
</head>
<body>
<h1>My Sample Project</h1>
</body>
</html>
scripts / main.js
$.ajax({
url: "http://server.com/fetchMeSomeData"
context: document.body,
success: function(data){
//this would be your sample callback
// you could be fetching the parameter to ask if it is debug state or not.
var isDebugSuffix = (data.isDebug)? "" : ".min";
require(["helper/util" + isDebugSuffix], function() {
//This function is called when scripts/helper/util.min.js is loaded but when the
//isDebug would be True, it would load scripts/helper/utils.js
//your other code can go here ...
});
}
});
これがあなたの道にあなたを設定することを願っています...