quik-pages
A plug-in for quik-server that makes it easy to manage webpages
Handles history for single-page-apps and also adds pages to the JSX chain
How do I use it?
Add the plugin to quik server let quikPageManager = server.quikAdd("quik-pages")
Then in your main frontend file (website.jsx)
let yourHomePageElementOrFunctionThatReturnsAnElement = document// add all your pages herepageManagerpages = Home : yourHomePageElementOrFunctionThatReturnsAnElement // tell it what you want to do when a specific page is loadedpageManger { if pageName == "home" || pageName == "" documentbody = pageManagerHome } // load the current page after loading this file for the first timepageManager // no arguments = use current page url
If you have included quik-dom or manually included good-JSX then the example could look like this: ```javascript let yourHomePageElementOrFunctionThatReturnsAnElement = Hey you're on the homepage // add all your pages here pageManager.pages = { Home : yourHomePageElementOrFunctionThatReturnsAnElement }
// tell it what you want to do when a specific page is loaded pageManger.load = (pageName) => { if (pageName == "home" || pageName == "") { document.body = } } // load the current page after loading this file for the first time pageManager.load() // no arguments = use current page url