feat(templates): use project object in server:setup

This commit is contained in:
Ayo 2023-11-13 14:52:57 +01:00
parent 97935f49e1
commit 018aeaac7e

View file

@ -6,7 +6,10 @@
-->
<my-head>
<script server:setup>
const name = "McFly";
const project = {
name: "McFly",
description: "Back to the Basics. Into the Future."
};
const author = {
name: "Ayo Ayco",
url: "https://ayco.io"
@ -15,14 +18,14 @@
</my-head>
<body>
<awesome-header>
<span>{{ name }}</span>
<span slot="description">Back to the Basics. Into the Future.</span>
<span>{{ project.name }}</span>
<span slot="description">{{ project.description }}</span>
</awesome-header>
<main>
<h2>Welcome to {{ name }}</h2>
<h2>Welcome to {{ project.name }}</h2>
<p>
Here's a vanilla custom element:
<vanilla-hello-world data-name="{{name}}" />
<vanilla-hello-world data-name="{{project.name}}" />
</p>
<code-block language="js">
class HelloWorld extends HTMLElement {