chore: update twind import map defaults in init.ts (#291)
This commit is contained in:
Vendored
+4
-2
@@ -2,8 +2,10 @@
|
||||
".": "THIS FILE EXISTS ONLY FOR VSCODE! IT IS NOT USED AT RUNTIME.",
|
||||
"imports": {
|
||||
"$fresh/": "../",
|
||||
"$twind": "https://esm.sh/twind@0.16.16",
|
||||
"$twind/": "https://esm.sh/twind@0.16.16/",
|
||||
|
||||
"@twind": "../www/utils/twind.ts",
|
||||
"twind": "https://esm.sh/twind@0.16.16",
|
||||
"twind/": "https://esm.sh/twind@0.16.16/",
|
||||
|
||||
"preact": "https://esm.sh/preact@10.8.1",
|
||||
"preact/": "https://esm.sh/preact@10.8.1/",
|
||||
|
||||
@@ -91,16 +91,16 @@ const importMap = {
|
||||
} as Record<string, string>,
|
||||
};
|
||||
if (useTwind) {
|
||||
importMap.imports["$twind"] = "https://esm.sh/twind@0.16.17";
|
||||
importMap.imports["$twind/"] = "https://esm.sh/twind@0.16.17/";
|
||||
importMap.imports["twind"] = "./utils/twind.ts";
|
||||
importMap.imports["@twind"] = "./utils/twind.ts";
|
||||
importMap.imports["twind"] = "https://esm.sh/twind@0.16.17";
|
||||
importMap.imports["twind/"] = "https://esm.sh/twind@0.16.17/";
|
||||
}
|
||||
const IMPORT_MAP_JSON = JSON.stringify(importMap, null, 2) + "\n";
|
||||
await Deno.writeTextFile(join(directory, "import_map.json"), IMPORT_MAP_JSON);
|
||||
|
||||
let ROUTES_INDEX_TSX = `/** @jsx h */
|
||||
import { h } from "preact";\n`;
|
||||
if (useTwind) ROUTES_INDEX_TSX += `import { tw } from "twind";\n`;
|
||||
if (useTwind) ROUTES_INDEX_TSX += `import { tw } from "@twind";\n`;
|
||||
ROUTES_INDEX_TSX += `import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
@@ -129,7 +129,7 @@ let ISLANDS_COUNTER_TSX = `/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
${useTwind ? 'import { tw } from "twind";\n' : ""}
|
||||
${useTwind ? 'import { tw } from "@twind";\n' : ""}
|
||||
interface CounterProps {
|
||||
start: number;
|
||||
}
|
||||
@@ -222,8 +222,8 @@ await Deno.writeTextFile(
|
||||
);
|
||||
|
||||
const UTILS_TWIND_TS = `import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import { Configuration, setup } from "$twind";
|
||||
export * from "$twind";
|
||||
import { Configuration, setup } from "twind";
|
||||
export * from "twind";
|
||||
export const config: Configuration = {
|
||||
darkMode: "class",
|
||||
mode: "silent",
|
||||
@@ -275,8 +275,8 @@ import manifest from "./fresh.gen.ts";
|
||||
|
||||
if (useTwind) {
|
||||
MAIN_TS += `
|
||||
import { virtualSheet } from "$twind/sheets";
|
||||
import { config, setup } from "twind";
|
||||
import { config, setup } from "@twind";
|
||||
import { virtualSheet } from "twind/sheets";
|
||||
|
||||
const sheet = virtualSheet();
|
||||
sheet.reset();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
|
||||
export function RoundedButton(props: h.JSX.HTMLAttributes<HTMLButtonElement>) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { apply, tw } from "../utils/twind.ts";
|
||||
import { apply, tw } from "@twind";
|
||||
|
||||
import {
|
||||
CATEGORIES,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
|
||||
const LINKS = [
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
|
||||
export function IconMinus() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
|
||||
export default function NavigationBar(props: { active: string }) {
|
||||
const items = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
import { h } from "preact";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
|
||||
export default function WarningBanner() {
|
||||
const warning = tw`bg-yellow-100 border(1 yellow-200) p-4 mb-4`;
|
||||
|
||||
+6
-2
@@ -1,11 +1,15 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../",
|
||||
"$twind": "https://esm.sh/twind@0.16.16",
|
||||
"$twind/": "https://esm.sh/twind@0.16.16/",
|
||||
|
||||
"@twind": "./utils/twind.ts",
|
||||
"twind": "https://esm.sh/twind@0.16.16",
|
||||
"twind/": "https://esm.sh/twind@0.16.16/",
|
||||
|
||||
"preact": "https://esm.sh/preact@10.8.1",
|
||||
"preact/": "https://esm.sh/preact@10.8.1/",
|
||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.2.0?deps=preact@10.8.1",
|
||||
|
||||
"$semver/": "https://deno.land/x/semver@v1.4.0/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { h } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
import { RoundedButton } from "../components/Button.tsx";
|
||||
import { IconMinus, IconPlus } from "../components/Icons.tsx";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/** @jsxFrag Fragment */
|
||||
import { Fragment, h } from "preact";
|
||||
import { useEffect, useRef, useState } from "preact/hooks";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
import { Spring, WaveTank } from "../components/WaveTank.ts";
|
||||
|
||||
function easeInCirc(x: number) {
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@
|
||||
/// <reference lib="deno.unstable" />
|
||||
|
||||
import { start } from "$fresh/server.ts";
|
||||
import { virtualSheet } from "$twind/sheets";
|
||||
import { setup, theme } from "./utils/twind.ts";
|
||||
import { virtualSheet } from "twind/sheets";
|
||||
import { setup, theme } from "@twind";
|
||||
|
||||
import routes from "./fresh.gen.ts";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Fragment, h } from "preact";
|
||||
import { Head } from "$fresh/runtime.ts";
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { apply, tw } from "../../utils/twind.ts";
|
||||
import { apply, tw } from "@twind";
|
||||
import { frontMatter, gfm } from "../../utils/markdown.ts";
|
||||
|
||||
import DocsSidebar from "../../components/DocsSidebar.tsx";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { ComponentChildren, Fragment, h } from "preact";
|
||||
import { asset, Head } from "$fresh/runtime.ts";
|
||||
import { Handlers, PageProps } from "$fresh/server.ts";
|
||||
import { tw } from "../utils/twind.ts";
|
||||
import { tw } from "@twind";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
import LemonDrop from "../islands/LemonDrop.tsx";
|
||||
import Footer from "../components/Footer.tsx";
|
||||
|
||||
+6
-3
@@ -1,7 +1,9 @@
|
||||
export * from "twind";
|
||||
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import { apply, setup, tw } from "$twind";
|
||||
import * as colors from "$twind/colors";
|
||||
export { apply, setup, tw };
|
||||
import * as colors from "twind/colors";
|
||||
import { setup } from "twind";
|
||||
|
||||
export const theme = {
|
||||
colors: {
|
||||
blue: colors.blue,
|
||||
@@ -13,6 +15,7 @@ export const theme = {
|
||||
transparent: "transparent",
|
||||
},
|
||||
};
|
||||
|
||||
if (IS_BROWSER) {
|
||||
setup({ theme: { colors } });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user