From 4611fdf87d406d7cd208e128ccdac0dabf90ad3a Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Thu, 20 Apr 2023 11:22:38 +1000 Subject: [PATCH] chore: add css-bundle boilerplate to templates --- templates/arc/app/root.tsx | 6 ++++++ templates/arc/package.json | 1 + templates/cloudflare-pages/app/root.tsx | 6 ++++++ templates/cloudflare-pages/package.json | 1 + templates/cloudflare-workers/app/root.tsx | 6 ++++++ templates/cloudflare-workers/package.json | 1 + templates/deno/app/root.tsx | 6 ++++++ templates/deno/package.json | 1 + templates/express/app/root.tsx | 6 ++++++ templates/express/package.json | 1 + templates/fly/app/root.tsx | 6 ++++++ templates/fly/package.json | 1 + templates/netlify/app/root.tsx | 6 ++++++ templates/netlify/package.json | 1 + templates/remix/app/root.tsx | 6 ++++++ templates/remix/package.json | 1 + templates/vercel/app/root.tsx | 6 ++++++ templates/vercel/package.json | 1 + 18 files changed, 63 insertions(+) diff --git a/templates/arc/app/root.tsx b/templates/arc/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/arc/app/root.tsx +++ b/templates/arc/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/arc/package.json b/templates/arc/package.json index 1cd76cdfade..888cfb5d697 100644 --- a/templates/arc/package.json +++ b/templates/arc/package.json @@ -11,6 +11,7 @@ }, "dependencies": { "@remix-run/architect": "*", + "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", "cross-env": "^7.0.3", diff --git a/templates/cloudflare-pages/app/root.tsx b/templates/cloudflare-pages/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/cloudflare-pages/app/root.tsx +++ b/templates/cloudflare-pages/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/cloudflare-pages/package.json b/templates/cloudflare-pages/package.json index a90db543fb1..63942d47109 100644 --- a/templates/cloudflare-pages/package.json +++ b/templates/cloudflare-pages/package.json @@ -13,6 +13,7 @@ "dependencies": { "@remix-run/cloudflare": "*", "@remix-run/cloudflare-pages": "*", + "@remix-run/css-bundle": "*", "@remix-run/react": "*", "cross-env": "^7.0.3", "isbot": "^3.6.5", diff --git a/templates/cloudflare-workers/app/root.tsx b/templates/cloudflare-workers/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/cloudflare-workers/app/root.tsx +++ b/templates/cloudflare-workers/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/cloudflare-workers/package.json b/templates/cloudflare-workers/package.json index 85bd8a7ce97..5056cd7882a 100644 --- a/templates/cloudflare-workers/package.json +++ b/templates/cloudflare-workers/package.json @@ -13,6 +13,7 @@ "dependencies": { "@remix-run/cloudflare": "*", "@remix-run/cloudflare-workers": "*", + "@remix-run/css-bundle": "*", "@remix-run/react": "*", "cross-env": "^7.0.3", "isbot": "^3.6.5", diff --git a/templates/deno/app/root.tsx b/templates/deno/app/root.tsx index a6a08d93909..7bd9545748a 100644 --- a/templates/deno/app/root.tsx +++ b/templates/deno/app/root.tsx @@ -6,8 +6,14 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/deno"; +import { cssBundleHref } from "@remix-run/css-bundle"; import * as React from "react"; +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; + export default function App() { return ( diff --git a/templates/deno/package.json b/templates/deno/package.json index 9a576b9a081..227e5723b34 100644 --- a/templates/deno/package.json +++ b/templates/deno/package.json @@ -13,6 +13,7 @@ "typecheck": "deno check" }, "dependencies": { + "@remix-run/css-bundle": "*", "@remix-run/deno": "*", "@remix-run/react": "*", "isbot": "^3.6.5", diff --git a/templates/express/app/root.tsx b/templates/express/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/express/app/root.tsx +++ b/templates/express/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/express/package.json b/templates/express/package.json index 6ce983974a9..34012800e45 100644 --- a/templates/express/package.json +++ b/templates/express/package.json @@ -10,6 +10,7 @@ "typecheck": "tsc" }, "dependencies": { + "@remix-run/css-bundle": "*", "@remix-run/express": "*", "@remix-run/node": "*", "@remix-run/react": "*", diff --git a/templates/fly/app/root.tsx b/templates/fly/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/fly/app/root.tsx +++ b/templates/fly/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/fly/package.json b/templates/fly/package.json index 31dca9f96b7..e091373746a 100644 --- a/templates/fly/package.json +++ b/templates/fly/package.json @@ -9,6 +9,7 @@ "typecheck": "tsc" }, "dependencies": { + "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", diff --git a/templates/netlify/app/root.tsx b/templates/netlify/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/netlify/app/root.tsx +++ b/templates/netlify/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/netlify/package.json b/templates/netlify/package.json index 1befe56d054..e8e96928922 100644 --- a/templates/netlify/package.json +++ b/templates/netlify/package.json @@ -9,6 +9,7 @@ }, "dependencies": { "@netlify/functions": "^1.3.0", + "@remix-run/css-bundle": "*", "@remix-run/netlify": "*", "@remix-run/node": "*", "@remix-run/react": "*", diff --git a/templates/remix/app/root.tsx b/templates/remix/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/remix/app/root.tsx +++ b/templates/remix/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/remix/package.json b/templates/remix/package.json index a3c4d4bd571..63b22fd1f20 100644 --- a/templates/remix/package.json +++ b/templates/remix/package.json @@ -8,6 +8,7 @@ "typecheck": "tsc" }, "dependencies": { + "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/serve": "*", diff --git a/templates/vercel/app/root.tsx b/templates/vercel/app/root.tsx index 1f082523e7b..a8b9c38907b 100644 --- a/templates/vercel/app/root.tsx +++ b/templates/vercel/app/root.tsx @@ -6,6 +6,12 @@ import { Scripts, ScrollRestoration, } from "@remix-run/react"; +import type { LinksFunction } from "@remix-run/node"; +import { cssBundleHref } from "@remix-run/css-bundle"; + +export const links: LinksFunction = () => [ + ...(cssBundleHref ? [{ rel: "stylesheet", href: cssBundleHref }] : []), +]; export default function App() { return ( diff --git a/templates/vercel/package.json b/templates/vercel/package.json index a3456b297ef..6b602969d9a 100644 --- a/templates/vercel/package.json +++ b/templates/vercel/package.json @@ -7,6 +7,7 @@ "typecheck": "tsc" }, "dependencies": { + "@remix-run/css-bundle": "*", "@remix-run/node": "*", "@remix-run/react": "*", "@remix-run/vercel": "*",