Skip to content

Instantly share code, notes, and snippets.

@faizalpribadi
Created September 11, 2013 14:01
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 faizalpribadi/6524010 to your computer and use it in GitHub Desktop.
Save faizalpribadi/6524010 to your computer and use it in GitHub Desktop.
Simple Example About AMD JS
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1>Hello <span class="name"></span></h1>
<script>
var require = {
paths: {
jquery: '../javascript/vendor/jquery'
}
};
</script>
<script data-main="resources/javascript/main" src="resources/javascript/vendor/require.js"></script>
</body>
</html>
require(['jquery'], function($) {
"use strict";
$(function() {
var name = prompt('what is you are name ?');
$('.name').text(name);
});
});
the directory for `libs` javascript vendor
`resources/javascript/vendor/jquery.js | require.js`
1. `jquery`
2. `require js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment