Initial commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.DS_Store
|
||||
|
||||
node_modules/
|
||||
16
README.md
Normal file
16
README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Basic RequireJS frontend demo
|
||||
|
||||
To run
|
||||
```js
|
||||
```
|
||||
```
|
||||
```
|
||||
```
|
||||
```
|
||||
```js
|
||||
npx http-server
|
||||
```
|
||||
```
|
||||
```
|
||||
```
|
||||
```
|
||||
15
index.html
Normal file
15
index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<header>
|
||||
<title>demo-requirejs</title>
|
||||
<!--
|
||||
Placing the requirejs script load here will block rendering it can also be placed at the end of the
|
||||
body with the 'async' attribute
|
||||
-->
|
||||
<script data-main="scripts/main" src="scripts/requirejs.js"></script>
|
||||
</header>
|
||||
<body>
|
||||
<h1>RequireJS Frontend DEMO</h1>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
7
scripts/app/Messages.js
Normal file
7
scripts/app/Messages.js
Normal file
@@ -0,0 +1,7 @@
|
||||
define(function() {
|
||||
return {
|
||||
getMessage: function() {
|
||||
return 'Hello World';
|
||||
}
|
||||
};
|
||||
});
|
||||
5
scripts/app/main.js
Normal file
5
scripts/app/main.js
Normal file
@@ -0,0 +1,5 @@
|
||||
define(function(require) {
|
||||
const messages = require('./Messages');
|
||||
|
||||
console.log(messages.getMessage());
|
||||
});
|
||||
6
scripts/main.js
Normal file
6
scripts/main.js
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
requirejs.config({
|
||||
baseUrl: '../scripts/'
|
||||
});
|
||||
|
||||
requirejs(["app/main"]);
|
||||
2146
scripts/requirejs.js
Normal file
2146
scripts/requirejs.js
Normal file
File diff suppressed because it is too large
Load Diff
8
scripts/utils/Names.js
Normal file
8
scripts/utils/Names.js
Normal file
@@ -0,0 +1,8 @@
|
||||
define(function() {
|
||||
console.log('[Names] loaded');
|
||||
return {
|
||||
formatName: function (first, last) {
|
||||
return `${first} ${last}`;
|
||||
}
|
||||
};
|
||||
})
|
||||
Reference in New Issue
Block a user