File tree Expand file tree Collapse file tree 4 files changed +24
-19
lines changed Expand file tree Collapse file tree 4 files changed +24
-19
lines changed Original file line number Diff line number Diff line change 1- const pages = import . meta. glob ( "#{__PLUGIN_PAGES_ROOT}" ) ;
1+ const pages = import . meta. glob ( "#{__PLUGIN_PAGES_ROOT}" , { eager : false } ) ;
22
33export const routes = normalizeRouteImports ( pages , [
44 new RegExp ( "#{__PLUGIN_PAGES_ROOT_REGEX}" ) ,
Original file line number Diff line number Diff line change 1- import { lazy } from "preact-iso" ;
1+ const contentMap = { } ;
2+ const posts = import . meta. glob ( "./**/*.mdx" , { eager : true } ) ;
3+ for ( let i in posts ) {
4+ contentMap [ i ] = "default" in posts [ i ] ? posts [ i ] . default : posts [ i ] ;
5+ }
26
37export const sideBar = {
48 introduction : {
59 order : 1 ,
610 label : "Introduction" ,
7- source : lazy ( ( ) => import ( "./introduction.mdx" ) ) ,
11+ source : contentMap [ "./introduction.mdx" ] ,
812 key : "introduction" ,
913 } ,
1014 essentials : {
1115 order : 2 ,
1216 label : "Essentials" ,
13- source : lazy ( ( ) => import ( "./essentials.mdx" ) ) ,
17+ source : contentMap [ "./essentials.mdx" ] ,
1418 key : "essentials" ,
1519 } ,
1620 aesthetics : {
1721 order : 3 ,
1822 label : "Aesthetics" ,
19- source : lazy ( ( ) => import ( "./aesthetics.mdx" ) ) ,
23+ source : contentMap [ "./aesthetics.mdx" ] ,
2024 key : "aesthetics" ,
2125 } ,
2226 "developer-experience" : {
2327 order : 4 ,
2428 label : "Developer Experience" ,
25- source : lazy ( ( ) => import ( "./developer-experience.mdx" ) ) ,
29+ source : contentMap [ "./developer-experience.mdx" ] ,
2630 key : "developer-experience" ,
2731 } ,
2832 frameworks : {
2933 order : 5 ,
3034 label : "Frameworks" ,
31- source : lazy ( ( ) => import ( "./frameworks.mdx" ) ) ,
35+ source : contentMap [ "./frameworks.mdx" ] ,
3236 key : "frameworks" ,
3337 } ,
3438 templates : {
3539 order : 6 ,
3640 label : "Templates" ,
37- source : lazy ( ( ) => import ( "./templates.mdx" ) ) ,
41+ source : contentMap [ "./templates.mdx" ] ,
3842 key : "templates" ,
3943 } ,
4044} ;
Original file line number Diff line number Diff line change 1- import { hydrate , render } from "preact" ;
1+ import { render } from "preact" ;
22import {
33 ErrorBoundary ,
44 LocationProvider ,
55 Route ,
66 Router ,
77 lazy ,
88 prerender as ssr ,
9+ hydrate ,
910} from "preact-iso" ;
1011import { routes } from "~routes" ;
1112import "./index.css" ;
Original file line number Diff line number Diff line change 1- import { lazy } from "preact-iso" ;
21import { sideBar } from "../content/data" ;
32import BaseLayout from "../layouts/base" ;
4- import { Suspense } from "preact/compat" ;
53
6- const AllContent = ( ) =>
7- Object . keys ( sideBar ) . map ( ( d , i ) => {
4+ const AllContent = ( ) => {
5+ const components = [ ] ;
6+ let i = - 1 ;
7+ for ( let d in sideBar ) {
8+ i ++ ;
89 const Component = sideBar [ d ] . source ;
910 const classList = i > 0 ? "mt-12 pt-12" : "" ;
10- return (
11- < Suspense fallback = { < div > Loading...</ div > } >
12- < Component class = { classList } />
13- </ Suspense >
14- ) ;
15- } ) ;
11+ components . push ( < Component class = { classList } /> ) ;
12+ }
13+
14+ return components ;
15+ } ;
1616
1717export default function HomePage ( ) {
1818 return (
You can’t perform that action at this time.
0 commit comments