Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antony/hapi-svelte-views
Svelte view plugin for HapiJS, which supports SSR and CSR
https://github.com/antony/hapi-svelte-views
csr hapi hapijs ssr static static-site static-site-generator svelte svelte3 sveltejs views vision
Last synced: 11 days ago
JSON representation
Svelte view plugin for HapiJS, which supports SSR and CSR
- Host: GitHub
- URL: https://github.com/antony/hapi-svelte-views
- Owner: antony
- Created: 2020-05-25T15:31:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T20:18:39.000Z (over 1 year ago)
- Last Synced: 2024-10-11T12:48:36.800Z (27 days ago)
- Topics: csr, hapi, hapijs, ssr, static, static-site, static-site-generator, svelte, svelte3, sveltejs, views, vision
- Language: JavaScript
- Size: 472 KB
- Stars: 9
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
## Hapi Svelte Views
Status: Working, but experimental
![publish](https://github.com/antony/hapi-svelte-views/workflows/publish/badge.svg)
[![NPM version](https://img.shields.io/npm/v/hapi-svelte-views.svg)](https://www.npmjs.com/package/hapi-svelte-views)### Installation and Usage
```bash
npm install --save-dev hapi-svelte-views svelte @hapi/vision
``````js
// server.js
const Vision = require('@hapi/vision')
const Svelte = require('hapi-svelte-views')// ... your server set-up here ...
// Register Vision and Svelte plugins
await server.register(Vision);
await server.register(Svelte);// Configure Vision / Svelte plugins
server.views({
engines: {
svelte: Svelte
},
relativeTo: __dirname,
path: 'views' // Put your .svelte components into 'views'
})// Some Route
server.route({
method: 'GET',
path: '/',
handler: (request, h) => {
// Render Home view and pass it some props
const props = { name: 'World' }
const layout = 'BasicLayout'
return h.view('Home', { layout, props })
}
})
``````js
// views/Home.svelte
Hello {name}!
``````js
// views/BasicLayout.svelte
- Brand
-
```