Most scalable website builder
- static
- components
- <component_name>
- style.css
- code.js
- <component_name>
- pages
- <page_name>
- style.css
- code.js
- <page_name>
- layout
- layout.html
- style.css
- code.js
- components
import { Page } from '../webserver.js'
import { Request } from 'express'
// Import components here
export class ExamplePage /* <-- Change name */ implements Page {
title = '<page_title>'
identifier = 'pages.<page_name>'
path = '/<path>'
includes = 17 // = Page.STYLE_AND_CODE
children = [ /* Register components here for style & code to work */ ]
buildFrom(req: Request): string {
return `<p>The body belongs here. Use ${<component>.buildFrom(...)} to place components.</p>`
}
}
Create the directory /static/pages/<page_name>/
and add these files there.
They will be automatically loaded.
import { Component } from '../webserver.js'
export default class ExampleComponent /* <-- Change name */ implements Component {
identifier = 'components.<component_name>'
includes = 1 // = Page.STYLE
buildFrom(data: unknown): string {
return `<p class="${this.identifier}">construct your own component here.</p>`
}
}
.components\.component_name /* query for children here */ {
/* Put your css here */
}