Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
".": "./src/mod.ts",
"./runtime": "./src/runtime/shared.ts",
"./dev": "./src/dev/mod.ts",
"./compat": "./src/compat.ts"
"./compat": "./src/compat.ts",
"./do-not-use": "./src/internals.ts"
},
"tasks": {
"test": "deno test -A --parallel",
Expand Down
17 changes: 7 additions & 10 deletions init/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ ${GRADIENT_CSS}`;
// Skip this and be silent if there is a network issue.
}

const MAIN_TS = `import { App, fsRoutes, staticFiles } from "fresh";
const MAIN_TS = `import { App, staticFiles } from "fresh";
import { define, type State } from "./utils.ts";

export const app = new App<State>();
Expand All @@ -371,10 +371,8 @@ const exampleLoggerMiddleware = define.middleware((ctx) => {
});
app.use(exampleLoggerMiddleware);

await fsRoutes(app, {
loadIsland: (path) => import(\`./islands/\${path}\`),
loadRoute: (path) => import(\`./routes/\${path}\`),
});
// Include file-system based routes here
app.fsRoutes();

if (import.meta.main) {
await app.listen();
Comment thread
marvinhagemeister marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -489,14 +487,13 @@ export default function Counter(props: CounterProps) {
const DEV_TS = `#!/usr/bin/env -S deno run -A --watch=static/,routes/
${useTailwind ? `import { tailwind } from "@fresh/plugin-tailwind";\n` : ""}
import { Builder } from "fresh/dev";
import { app } from "./main.ts";

const builder = new Builder();
${useTailwind ? "tailwind(builder, app);" : ""}
${useTailwind ? "tailwind(builder);" : ""}
if (Deno.args.includes("build")) {
await builder.build(app);
await builder.build();
} else {
await builder.listen(app);
await builder.listen(() => import("./main.ts"));
}`;
await writeFile("dev.ts", DEV_TS);

Expand All @@ -506,7 +503,7 @@ if (Deno.args.includes("build")) {
check: "deno fmt --check . && deno lint . && deno check",
dev: "deno run -A --watch=static/,routes/ dev.ts",
build: "deno run -A dev.ts build",
start: "deno run -A main.ts",
start: "deno serve -A _fresh/server.js",
Comment thread
marvinhagemeister marked this conversation as resolved.
update: "deno run -A -r jsr:@fresh/update .",
},
lint: {
Expand Down
2 changes: 1 addition & 1 deletion init/src/init_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@ Deno.test("init - errors on missing build cache in prod", async () => {
const { stderr } = getStdOutput(cp);
expect(cp.code).toEqual(1);

expect(stderr).toMatch(/Found 1 islands, but did not/);
expect(stderr).toMatch(/Module not found/);
});
6 changes: 2 additions & 4 deletions plugin-tailwindcss/src/mod.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import type { Builder } from "fresh/dev";
import type { App } from "fresh";
import twPostcss from "@tailwindcss/postcss";
import postcss from "postcss";
import type { TailwindPluginOptions } from "./types.ts";

// Re-export types for public API
export type { TailwindPluginOptions } from "./types.ts";

export function tailwind<T>(
export function tailwind(
builder: Builder,
app: App<T>,
options: TailwindPluginOptions = {},
): void {
const { exclude, ...tailwindOptions } = options;
const instance = postcss(twPostcss({
optimize: app.config.mode === "production",
optimize: builder.config.mode === "production",
...tailwindOptions,
}));

Expand Down
Loading