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> <my-head>
<script server:setup> <script server:setup>
const name = "McFly"; const project = {
name: "McFly",
description: "Back to the Basics. Into the Future."
};
const author = { const author = {
name: "Ayo Ayco", name: "Ayo Ayco",
url: "https://ayco.io" url: "https://ayco.io"
@ -15,14 +18,14 @@
</my-head> </my-head>
<body> <body>
<awesome-header> <awesome-header>
<span>{{ name }}</span> <span>{{ project.name }}</span>
<span slot="description">Back to the Basics. Into the Future.</span> <span slot="description">{{ project.description }}</span>
</awesome-header> </awesome-header>
<main> <main>
<h2>Welcome to {{ name }}</h2> <h2>Welcome to {{ project.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="{{project.name}}" />
</p> </p>
<code-block language="js"> <code-block language="js">
class HelloWorld extends HTMLElement { class HelloWorld extends HTMLElement {