summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-03-18 12:25:30 +0100
committerPeter Wu <peter@lekensteyn.nl>2015-03-18 12:25:30 +0100
commita7530e4ef857ebb7bbe92b1aa07157f8475ea55e (patch)
tree0f14303cded2bf988f72f54d966a138cc5a6b8b0
parent4cf80e14033767f8b5b992bb9df098d6b59bf3b2 (diff)
downloadsite-a7530e4ef857ebb7bbe92b1aa07157f8475ea55e.tar.gz
use requirejs
-rw-r--r--.jshintrc16
-rw-r--r--index.html4
-rw-r--r--js/boot.js5
-rw-r--r--js/main.js5
4 files changed, 25 insertions, 5 deletions
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..8eab36c
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,16 @@
+{
+ "globals": {
+ "require": true,
+ "define": true,
+ "module": true
+ },
+ "browser": true,
+
+ "globalstrict": true,
+ "moz": true,
+ "undef": true,
+ // for console.log
+ "devel": true,
+
+ "maxerr": 1000
+}
diff --git a/index.html b/index.html
index f92e990..951c017 100644
--- a/index.html
+++ b/index.html
@@ -7,7 +7,7 @@
<link rel="stylesheet" type="text/less" href="style/main.less">
<!-- TODO: autoprefixer -->
-<script src="less.js"></script>
+<script src="lib/less.js"></script>
<script>
// fallback if a local less.js file cannot be loaded.
window.less || document.write('<script src="' +
@@ -44,6 +44,6 @@ Contact:<br>
</p>
</footer>
-<script src="js/main.js"></script>
+<script data-main="js/boot" src="lib/require.js"></script>
</body>
</html>
diff --git a/js/boot.js b/js/boot.js
new file mode 100644
index 0000000..54f5b32
--- /dev/null
+++ b/js/boot.js
@@ -0,0 +1,5 @@
+/* globals requirejs */
+requirejs.config({
+ baseUrl: 'js'
+});
+requirejs(['main']);
diff --git a/js/main.js b/js/main.js
index 8f96057..c3191f6 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,5 +1,4 @@
-/* jshint browser:true, devel:true */
-(function() {
+define(function() {
'use strict';
/* loads a page into view and execute scripts */
@@ -40,4 +39,4 @@
if (!selectPage(location.hash.replace(/^#\//, ''))) {
location.hash = '#/home';
}
-})();
+});