Skip to content

Commit

Permalink
Fix dev SSR preloading
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro committed Mar 29, 2024
1 parent 614cfaa commit 3a9d363
Show file tree
Hide file tree
Showing 30 changed files with 413 additions and 242 deletions.
22 changes: 11 additions & 11 deletions postcss.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import tailwindcss from "tailwindcss";
import postcssPresentEnv from "postcss-preset-env";
import pxtorem from "postcss-pxtorem";


export default {
plugins: [
pxtorem({
replace: true,
propList: ["*"],
}),
postcssPresentEnv(),
tailwindcss,
...(process.env.NODE_ENV === "production" ? [cssnano] : []),
]
};
plugins: [
pxtorem({
replace: true,
propList: ["*"],
}),
postcssPresentEnv(),
tailwindcss,
...(process.env.NODE_ENV === "production" ? [cssnano] : []),
],
};

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/fonts/noto-sans-jp-v40-japanese-700.eot
Binary file not shown.
47 changes: 47 additions & 0 deletions public/fonts/noto-sans-jp-v40-japanese-700.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/fonts/noto-sans-jp-v40-japanese-700.woff
Binary file not shown.
Binary file added public/fonts/noto-sans-jp-v40-japanese-700.woff2
Binary file not shown.
Binary file not shown.
47 changes: 47 additions & 0 deletions public/fonts/noto-sans-jp-v40-japanese-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
26 changes: 26 additions & 0 deletions src/BlogArticle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {JSX, Component} from "solid-js";
import {css} from "@linaria/core";
import cn from "classnames";


interface Props {
children?: JSX.Element;
}

const BlogArticle: Component<Props> = (props) => {
const {children} = $destructure(props);

return (
<div class={cn(_BlogArticle)}>
{children}
</div>
);
};


const _BlogArticle = css`
`;



export default BlogArticle;
13 changes: 0 additions & 13 deletions src/app.css

This file was deleted.

50 changes: 6 additions & 44 deletions src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import "~/style/global.style";

import { MetaProvider, Title } from "@solidjs/meta";
import { RouteDefinition, Router } from "@solidjs/router";
import { Suspense, lazy } from "solid-js";
import { Router } from "@solidjs/router";
import { Suspense } from "solid-js";
import { config } from "~/config";

import Header from "~/Header";
import "~/style/global.style";
import "./app.css";

const BlogIndex = lazy(() => import("~/BlogIndex"));
const GallerySite = lazy(() => import("~/GallerySite"));

const articlesImportMap = import.meta.glob("./articles/*.mdx");
const getArticleComponent = (name: string) =>
articlesImportMap[`./articles/${name}.mdx`];
import { routes } from "~/routes";

export default function App() {
return (
Expand All @@ -28,38 +21,7 @@ export default function App() {
</MetaProvider>
)}
>
{
[
{ path: "/", component: () => <BlogIndex /> },
{ path: "/gallery", component: () => <GallerySite /> },
{
path: "/articles/:name",
component: (p) => {
// router bug: 'name' not in 'p', update when this is fixed
const name = p.location.pathname.replace(
`${config.base}/articles/`,
"",
);
const Article = lazy(getArticleComponent(name) as any);
return (
<Article
components={
{
// h1: () => {
// return <span>hi</span>;
// },
}
}
{...p}
/>
);
},
matchFilters: {
name: (name: string) => !!getArticleComponent(name),
},
},
] as RouteDefinition[]
}
{routes}
</Router>
);
}
1 change: 0 additions & 1 deletion src/atoms/Text.md

This file was deleted.

7 changes: 0 additions & 7 deletions src/components/Counter.css

This file was deleted.

24 changes: 0 additions & 24 deletions src/components/Counter.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions src/routeMap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import App from "~/app";
import BlogIndex from "~/BlogIndex";
import GallerySite from "~/GallerySite";

export const routeMap: Record<string, string | string[]> = {
"/*": [App],
"/": [BlogIndex],
"/gallery": [GallerySite],
} as any;
37 changes: 37 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { RouteDefinition } from "@solidjs/router";
import { lazy } from "solid-js";
import { config } from "~/config";

const BlogIndex = lazy(() => import("~/BlogIndex"));

const articlesImportMap = import.meta.glob("./articles/*.mdx");
const getArticleComponent = (name: string) =>
articlesImportMap[`./articles/${name}.mdx`];

export const routes: RouteDefinition[] = [
{ path: "/", component: () => <BlogIndex /> },
{ path: "/gallery", component: lazy(() => import("~/GallerySite")) },
{
path: "/articles/:name",
component: (p) => {
// router bug: 'name' not in 'p', update when this is fixed
const name = p.location.pathname.replace(`${config.base}/articles/`, "");
const Article = lazy(getArticleComponent(name) as any);
return (
<Article
components={
{
// h1: () => {
// return <span>hi</span>;
// },
}
}
{...p}
/>
);
},
matchFilters: {
name: (name: string) => !!getArticleComponent(name),
},
},
];
Loading

0 comments on commit 3a9d363

Please sign in to comment.