Created
July 11, 2019 06:51
-
-
Save ff6347/87e6f41b946c6dc50f608ef0011c87af to your computer and use it in GitHub Desktop.
Using modules in HTML
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="x-ua-compatible" content="ie=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
| <title>Page Title</title> | |
| <meta name="description" content="something"> | |
| <meta name="author" content="me"> | |
| </head> | |
| <body> | |
| <script type="module" src="./module.js"></script> | |
| <script type="module" src="./index.js"></script> | |
| </body> | |
| </html> |
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
| import {hello} from './module.js' | |
| document.addEventListener('DOMContentLoaded',function() { | |
| console.info(hello('world')); | |
| }); |
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
| export const hello = (str) => `Hello ${str}!`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment