feat: add thymeleaf assets processor

Signed-off-by: Ryan Wang <i@ryanc.cc>
This commit is contained in:
Ryan Wang
2022-07-29 18:06:56 +08:00
parent ceceb37349
commit a46eebfb87
20 changed files with 265 additions and 30 deletions
+9 -13
View File
@@ -1,15 +1,11 @@
<!DOCTYPE html>
<!DOCTYPE html><html lang="en" class="astro-MXGA4QHU">
<head>
<!DOCTYPE html><html lang="en" class="astro-3BZDFDD4"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<title>Welcome to Astro.</title>
<link rel="stylesheet" href="/assets/81b427f6.dbc606a6.css" />
<link rel="stylesheet" href="/assets/04b34e77.eb1eaf30.css" /></head>
<link rel="stylesheet" href="/assets/c3308dde.eb1eaf30.css" th:href="@{/assets/c3308dde.eb1eaf30.css}">
<link rel="stylesheet" href="/assets/4669d51c.dbc606a6.css" th:href="@{/assets/4669d51c.dbc606a6.css}"></head>
<body class="astro-MXGA4QHU">
<body class="astro-3BZDFDD4">
<main class="astro-SJCY3QFU">
<h1 class="astro-SJCY3QFU">Welcome to <span class="text-gradient astro-SJCY3QFU">Astro</span></h1>
<p class="instructions astro-SJCY3QFU">
@@ -21,7 +17,7 @@
<a href="https://docs.astro.build/" class="astro-DYDDWWYO">
<h2 class="astro-DYDDWWYO">
Documentation
<span class="astro-DYDDWWYO">&rarr;</span>
<span class="astro-DYDDWWYO"></span>
</h2>
<p class="astro-DYDDWWYO">
Learn how Astro works and explore the official API docs.
@@ -32,7 +28,7 @@
<a href="https://astro.build/integrations/" class="astro-DYDDWWYO">
<h2 class="astro-DYDDWWYO">
Integrations
<span class="astro-DYDDWWYO">&rarr;</span>
<span class="astro-DYDDWWYO"></span>
</h2>
<p class="astro-DYDDWWYO">
Supercharge your project with new frameworks and libraries.
@@ -43,7 +39,7 @@
<a href="https://astro.build/themes/" class="astro-DYDDWWYO">
<h2 class="astro-DYDDWWYO">
Themes
<span class="astro-DYDDWWYO">&rarr;</span>
<span class="astro-DYDDWWYO"></span>
</h2>
<p class="astro-DYDDWWYO">
Explore a galaxy of community-built starter themes.
@@ -54,7 +50,7 @@
<a href="https://astro.build/chat/" class="astro-DYDDWWYO">
<h2 class="astro-DYDDWWYO">
Chat
<span class="astro-DYDDWWYO">&rarr;</span>
<span class="astro-DYDDWWYO"></span>
</h2>
<p class="astro-DYDDWWYO">
Come say hi to our amazing Discord community. ❤️
@@ -62,6 +58,6 @@
</a>
</li>
</ul>
<style>astro-island,astro-slot{display:contents}</style><script>(self.Astro=self.Astro||{}).visible=(i,c,n)=>{const r=async()=>{await(await i())()};let s=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){s.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];s.observe(t)}};var a;{const l={0:t=>t,1:t=>JSON.parse(t,n),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,n)),5:t=>new Set(JSON.parse(t,n)),6:t=>BigInt(t),7:t=>new URL(t)},n=(t,r)=>{if(t===""||!Array.isArray(r))return r;const[e,i]=r;return e in l?l[e](i):void 0};customElements.get("astro-island")||customElements.define("astro-island",(a=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement?.closest("astro-island[ssr]"))return;const r=this.querySelectorAll("astro-slot"),e={},i=this.querySelectorAll("template[data-astro-template]");for(const s of i)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("data-astro-template")||"default"]=s.innerHTML,s.remove());for(const s of r)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("name")||"default"]=s.innerHTML);const o=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),n):{};this.hydrator(this)(this.Component,o,e,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),window.removeEventListener("astro:hydrate",this.hydrate),window.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener("astro:hydrate",this.hydrate),await import(this.getAttribute("before-hydration-url"));const r=JSON.parse(this.getAttribute("opts"));Astro[this.getAttribute("client")](async()=>{const e=this.getAttribute("renderer-url"),[i,{default:o}]=await Promise.all([import(this.getAttribute("component-url")),e?import(e):()=>()=>{}]);return this.Component=i[this.getAttribute("component-export")||"default"],this.hydrator=o,this.hydrate},r,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},a.observedAttributes=["props"],a))}</script><astro-island uid="kvGpf" component-url="/PostCard.66b292e1.js" component-export="default" renderer-url="/client.6e2af5c0.js" props="{&quot;class&quot;:[0,&quot;astro-SJCY3QFU&quot;]}" ssr="" client="visible" before-hydration-url="data:text/javascript;charset=utf-8,//[no before-hydration script]" opts="{&quot;name&quot;:&quot;PostCard&quot;,&quot;value&quot;:true}" await-children=""><div class="p-4 astro-SJCY3QFU"><span class="font-bold text-xl" th:text="@{post.title}">Hello Halo</span><div class="flex flex-col items-center py-16"><div class="h-32 w-32"><div class="h-full w-full rounded-md bg-white shadow-lg"></div></div><button class="mt-8 flex transform items-center rounded-full bg-black bg-opacity-20 px-3 py-2 text-sm font-medium text-white transition hover:scale-105 hover:bg-opacity-30 focus:outline-none active:bg-opacity-40"><svg viewBox="0 0 20 20" fill="none" class="h-5 w-5 opacity-70"><path d="M14.9497 14.9498C12.2161 17.6835 7.78392 17.6835 5.05025 14.9498C2.31658 12.2162 2.31658 7.784 5.05025 5.05033C7.78392 2.31666 12.2161 2.31666 14.9497 5.05033C15.5333 5.63385 15.9922 6.29475 16.3266 7M16.9497 2L17 7H16.3266M12 7L16.3266 7" stroke="currentColor" stroke-width="1.5"></path></svg><span class="ml-3">Click to transition</span></button></div></div></astro-island>
<style>astro-island,astro-slot{display:contents}</style><script>(self.Astro=self.Astro||{}).visible=(i,c,n)=>{const r=async()=>{await(await i())()};let s=new IntersectionObserver(e=>{for(const t of e)if(!!t.isIntersecting){s.disconnect(),r();break}});for(let e=0;e<n.children.length;e++){const t=n.children[e];s.observe(t)}};var a;{const l={0:t=>t,1:t=>JSON.parse(t,n),2:t=>new RegExp(t),3:t=>new Date(t),4:t=>new Map(JSON.parse(t,n)),5:t=>new Set(JSON.parse(t,n)),6:t=>BigInt(t),7:t=>new URL(t)},n=(t,r)=>{if(t===""||!Array.isArray(r))return r;const[e,i]=r;return e in l?l[e](i):void 0};customElements.get("astro-island")||customElements.define("astro-island",(a=class extends HTMLElement{constructor(){super(...arguments);this.hydrate=()=>{if(!this.hydrator||this.parentElement?.closest("astro-island[ssr]"))return;const r=this.querySelectorAll("astro-slot"),e={},i=this.querySelectorAll("template[data-astro-template]");for(const s of i)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("data-astro-template")||"default"]=s.innerHTML,s.remove());for(const s of r)!s.closest(this.tagName)?.isSameNode(this)||(e[s.getAttribute("name")||"default"]=s.innerHTML);const o=this.hasAttribute("props")?JSON.parse(this.getAttribute("props"),n):{};this.hydrator(this)(this.Component,o,e,{client:this.getAttribute("client")}),this.removeAttribute("ssr"),window.removeEventListener("astro:hydrate",this.hydrate),window.dispatchEvent(new CustomEvent("astro:hydrate"))}}connectedCallback(){!this.hasAttribute("await-children")||this.firstChild?this.childrenConnectedCallback():new MutationObserver((r,e)=>{e.disconnect(),this.childrenConnectedCallback()}).observe(this,{childList:!0})}async childrenConnectedCallback(){window.addEventListener("astro:hydrate",this.hydrate),await import(this.getAttribute("before-hydration-url"));const r=JSON.parse(this.getAttribute("opts"));Astro[this.getAttribute("client")](async()=>{const e=this.getAttribute("renderer-url"),[i,{default:o}]=await Promise.all([import(this.getAttribute("component-url")),e?import(e):()=>()=>{}]);return this.Component=i[this.getAttribute("component-export")||"default"],this.hydrator=o,this.hydrate},r,this)}attributeChangedCallback(){this.hydrator&&this.hydrate()}},a.observedAttributes=["props"],a))}</script><astro-island uid="s8rrH" component-url="/assets/PostCard.42ac9187.js" component-export="default" renderer-url="/assets/client.e67fc49c.js" props="{&quot;class&quot;:[0,&quot;astro-SJCY3QFU&quot;]}" ssr="" client="visible" before-hydration-url="data:text/javascript;charset=utf-8,//[no before-hydration script]" opts="{&quot;name&quot;:&quot;PostCard&quot;,&quot;value&quot;:true}" await-children="" th:component-url="@{/assets/PostCard.42ac9187.js}" th:renderer-url="@{/assets/client.e67fc49c.js}"><div class="p-4 astro-SJCY3QFU"><span class="font-bold text-xl" th:text="@{post.title}">Hello Halo</span><div class="flex flex-col items-center py-16"><div class="h-32 w-32"><div class="h-full w-full rounded-md bg-white shadow-lg"></div></div><button class="mt-8 flex transform items-center rounded-full bg-black bg-opacity-20 px-3 py-2 text-sm font-medium text-white transition hover:scale-105 hover:bg-opacity-30 focus:outline-none active:bg-opacity-40"><svg viewBox="0 0 20 20" fill="none" class="h-5 w-5 opacity-70"><path d="M14.9497 14.9498C12.2161 17.6835 7.78392 17.6835 5.05025 14.9498C2.31658 12.2162 2.31658 7.784 5.05025 5.05033C7.78392 2.31666 12.2161 2.31666 14.9497 5.05033C15.5333 5.63385 15.9922 6.29475 16.3266 7M16.9497 2L17 7H16.3266M12 7L16.3266 7" stroke="currentColor" stroke-width="1.5"></path></svg><span class="ml-3">Click to transition</span></button></div></div></astro-island>
</main>
</body></html>