|
| 1 | +!DOCTYPE_MODULO(` |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +# Modulo |
| 6 | + |
| 7 | +Modulo is a lightweight framework for creating **HTML Web Components**: Reusable |
| 8 | +snippets of HTML, CSS, and JavaScript that create new HTML-like tags that can |
| 9 | +be used and reused anywhere on your site. Modulo runs entirely in the browser, |
| 10 | +and can be incorporated with just a couple lines of code into any HTML file |
| 11 | +(see the "Quick start"), such that **no terminal usage is necessary**. However, |
| 12 | +if you prefer, you can also start projects using NPM from the Terminal (see the |
| 13 | +"NPM start"). |
| 14 | + |
| 15 | +- Beginner-friendly features inspired by React, Svelte, and Vue.js, in only |
| 16 | + 2000 lines of dependency-free, self-building JavaScript. A “no fuss” drop-in |
| 17 | + for existing web apps or Jamstack static sites. |
| 18 | + |
| 19 | +- Try interactive demos and learn more on the website: <https://modulojs.org/> |
| 20 | + |
| 21 | +Project Status: \`alpha\` *(Well-documented with lots of examples, but still a |
| 22 | +work in progress -- help by trying it out!)* |
| 23 | + |
| 24 | +----- |
| 25 | + |
| 26 | +## Quick start |
| 27 | + |
| 28 | + |
| 29 | +1. Include in any HTML file the single Modulo JavaScript file loaded from a CDN: |
| 30 | + |
| 31 | +\`\`\`html |
| 32 | +<script src="https://unpkg.com/mdu.js"></script> |
| 33 | +\`\`\` |
| 34 | + |
| 35 | + |
| 36 | +2. Now define one or more Modulo web components (custom HTML elements). First, |
| 37 | +use \`<template Modulo>\` and \`</template>\` to mark where in your HTML you are |
| 38 | +defining our components. Then, add "Template", "Script", and "Style" tags, to |
| 39 | +incorporate HTML, JavaScript, and CSS respectively into your component. E.g.: |
| 40 | + |
| 41 | +\`\`\`html |
| 42 | +<template Modulo> |
| 43 | + <Component name="HelloWorld"> |
| 44 | + <Template> |
| 45 | + Hello <strong>Modulo</strong> World! |
| 46 | + </Template> |
| 47 | + <Script> |
| 48 | + console.log('Hello Modulo JS world!'); |
| 49 | + </Script> |
| 50 | + <Style> |
| 51 | + strong { color: purple; } |
| 52 | + </Style> |
| 53 | + </Component> |
| 54 | +</template> |
| 55 | +<script src="https://unpkg.com/mdu.js"></script> |
| 56 | +\`\`\` |
| 57 | + |
| 58 | +3. Now, you can use and reuse this new custom element wherever you want, just |
| 59 | +like any normal HTML tag. E.g.: |
| 60 | + |
| 61 | +\`\`\`html |
| 62 | +<x-HelloWorld></x-HelloWorld> |
| 63 | +<p>In a P tag: <x-HelloWorld></x-HelloWorld></p> |
| 64 | +\`\`\` |
| 65 | + |
| 66 | + |
| 67 | +* *(Optional)* Download [src/Modulo.js](https://unpkg.com/mdu.js) |
| 68 | + (the single 2000-line file that contains all of the framework) to wherever |
| 69 | + you put JS files for your website (for example, \`/static/js/Modulo.js\`) |
| 70 | + |
| 71 | + |
| 72 | +* **Continue?** Want to try more? The official beginner tutorial picks up where |
| 73 | + this leaves off: |
| 74 | + [Ramping Up with Modulo - Part 1](https://modulojs.org/tutorial/ramping-up/part1.html) |
| 75 | + |
| 76 | + |
| 77 | +## NPM start |
| 78 | + |
| 79 | +Prefer command-line tools, such as NPM? Run the following, and follow the |
| 80 | +on-screen commands: |
| 81 | + |
| 82 | +\`\`\`bash |
| 83 | +npm init modulo |
| 84 | +\`\`\` |
| 85 | + |
| 86 | + |
| 87 | +----- |
| 88 | + |
| 89 | +## License |
| 90 | + |
| 91 | +(C) 2023 - Michael Bethencourt [LGPLv3](https://unpkg.com/mdu.js) |
| 92 | + |
| 93 | +`) |
0 commit comments