How to style _layout.tsx?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- deno, typescript
- Domain
- frontend
Research direction
Start by reproducing the reported behavior in a Fresh 2.3.3 project created with deno run -Ar jsr:@fresh/init, using the shown routes/index.tsx, routes/_layout.tsx, and CSS files. Run deno task build and inspect how _fresh/client/assets/_fresh-route___test-XXXX.css and server-entry-XXXX.css are generated and served; determine whether layout styles should be served and document or fix the behavior.
Written by the indexing model from the issue text.
Description
Hi, I am unable to style a layout.
Environment and reproduction steps:
- Deno 2.8, Fresh 2.3.3
- Create a new Deno project, created with
deno run -Ar jsr:@fresh/init - Make sure you have the following files in the
routesfolder:
index.tsx
import { define } from "@/utils.ts";
import '@/assets/index.css';
export default define.page(function Home() {
return (
<div>Hello world</div>
);
});
_layout.tsx
import { define } from "@/utils.ts";
import '@/assets/layout.css';
export default define.layout(function Layout({ Component }) {
return (
<div>
<h1 class="layout">Layout</h1>
<Component />
</div>
);
});
assets/layout.css
h1.layout {
color: red;
}
assets/index.css
h1.test {
color: green;
}
Result: h1 in index.tsx is colored green, but h1 in layout is not colored red - which is what I should expect.
After running deno task build I have the following files:
_fresh/client/assets/_fresh-route___test-XXXX.css
h1.test{color:green}
_fresh/client/assets/server-entry-XXXX.css
h1.layout{color:red}
So the styles are present. HOWEVER, that server-entry file is never served; so it won't do anything.
Question: is this a bug, should Fresh serve that server-entry.css? Or am I misunderstanding the way of styling?
- No, I don't want Tailwind CSS.
- This issue is written by a human
- Claude and other AIs were unable to solve this problem
Can anyone help? And explain to me what that server-entry CSS file is?
- Dominant language
- TypeScript
- Stars
- 13.8k
- Forks
- 757
- Avg merge
- 3m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from freshframework/fresh
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
freshframework/fresh#3920 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
freshframework/fresh#3833 ·
-
feat
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
freshframework/fresh#3803 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
freshframework/fresh#3918 · 1 comment · 4 reactions ·
-
Tab title doesn't update to <Head> <title> when navigating to a page with another <title>Possibly taken @1AbdullahButt claimed this 7 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 57/100
freshframework/fresh#3916 ·
All issues in freshframework/fresh
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tintinweb/pi-subagents#459 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
danielmiessler/LifeOS#2830 ·
Maintainers usually reply within 6 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
area: client enhancement priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
opensro-dev/opensro#3681 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day