refactor(templates): clean up basic template

This commit is contained in:
Ayo 2023-10-29 18:56:43 +01:00
parent c74421ccb0
commit 8e265925ac
7 changed files with 10 additions and 40 deletions

2
.gitignore vendored
View file

@ -1,10 +1,10 @@
dist
node_modules node_modules
*.log* *.log*
.nitro .nitro
.cache .cache
.output .output
.env .env
dist
*~ *~
*swp *swp
*swo *swo

2
package-lock.json generated
View file

@ -4000,7 +4000,7 @@
} }
}, },
"packages/create-mcfly": { "packages/create-mcfly": {
"version": "0.3.3", "version": "0.3.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"consola": "^3.2.3", "consola": "^3.2.3",

View file

@ -1,3 +1,3 @@
dist dist
.output
node-modules node-modules
.output

View file

@ -1,7 +1,10 @@
dist
node_modules node_modules
*.log* *.log*
.nitro .nitro
.cache .cache
.output .output
.env .env
dist *~
*swp
*swo

View file

@ -1,14 +1,11 @@
# McFly Starter Project # McFly Starter Project
![template-basic](https://raw.githubusercontent.com/ayoayco/McFly/main/assets/template-basic.png)
## Background ## Background
This project was generated from the basic template for **McFly** -- a no-framework framework that assists in leveraging the web platform. This project was generated from the basic template for **McFly** -- a no-framework framework that assists in leveraging the web platform.
``` ![template-basic](https://raw.githubusercontent.com/ayoayco/McFly/main/assets/template-basic.png)
npm create mcfly@latest
```
It contains example files to get you started using vanilla web technologies in a modern way. See the [Special Directories](#special-directories) section for more information. It contains example files to get you started using vanilla web technologies in a modern way. See the [Special Directories](#special-directories) section for more information.
@ -61,11 +58,6 @@ The following commands are available to you on this project. Add more, or modify
| npm run preview | Preview the built app locally | | npm run preview | Preview the built app locally |
## More info
This framework is a result of [an exploration](https://social.ayco.io/@ayo/111195315785886977) for using [**Nitro**](https://nitro.unjs.io) and vanilla JS custom elements using a minimal [**Web Component Base**](https://ayco.io/n/web-component-base) class.
**Nitro** is the same production-grade web server powering [**Nuxt**](https://nuxt.com/)
--- ---
*Just keep building*<br /> *Just keep building*<br />
*A project by [Ayo Ayco](https://ayco.io)* *A project by [Ayo Ayco](https://ayco.io)*

View file

@ -1,3 +1,2 @@
import McFly from "@mcflyjs/config"; import McFly from "@mcflyjs/config";
export default defineNitroConfig({ ...McFly() }); export default defineNitroConfig({ ...McFly() });

View file

@ -3,40 +3,21 @@
<!-- <!--
Hello! This page is an example McFly page. Hello! This page is an example McFly page.
See more on https://ayco.io/gh/McFly See more on https://ayco.io/gh/McFly
<my-head> here is a static HTML fragment found in ./components/my-head.html
you can reuse it to have the same <head> on every page
any children will be inserted into the <slot /> on the fragment
--> -->
<my-head> <my-head>
<script server:setup> <script server:setup>
/**
* This server:setup script block will get evaluated on the server
* ...then get stripped away, leaving just the HTML
* */
const name = "McFly"; const name = "McFly";
const author = "Ayo Ayco";
</script> </script>
</my-head> </my-head>
<body> <body>
<!--
This element below is a static HTML fragment, found in ./components/awesome-header.html
-->
<awesome-header></awesome-header> <awesome-header></awesome-header>
<main> <main>
<!--
any variable declared in a server:setup script can be used on the page
-->
<h2>Welcome to {{name}}</h2> <h2>Welcome to {{name}}</h2>
<p> <p>
Here's a vanilla custom element: Here's a vanilla custom element:
<vanilla-hello-world data-name="{{name}}" /> <vanilla-hello-world data-name="{{name}}" />
</p> </p>
<!--
this is just a code-block element, found in ./components/code-block.js
(not an actual JS code)
-->
<code-block language="js"> <code-block language="js">
<pre> <pre>
class HelloWorld extends HTMLElement { class HelloWorld extends HTMLElement {
@ -60,13 +41,8 @@ class HelloWorld extends HTMLElement {
> >
</code-block> </code-block>
</main> </main>
<!--
Here's another static .html fragment, found in ./components/my-footer.html
The child <small> element gets inserted into the <slot /> on the fragment
-->
<my-footer> <my-footer>
<small>A project by <a href="https://ayo.ayco.io">Ayo Ayco</a></small> <small>A project by <a href="https://ayco.io">{{author}}</a></small>
</my-footer> </my-footer>
</body> </body>
</html> </html>