solidjs / solid-start

SolidStart, the Solid app framework
https://start.solidjs.com
MIT License
5k stars 373 forks source link

[Bug?]: TailwindCSS is being unloaded on route change #1271

Closed oezguerisbert closed 5 months ago

oezguerisbert commented 7 months ago

Duplicates

Latest version

Current behavior 😯

I made a small video here, where I showcase the bug I am facing. I have a project that uses the latest version of @solidjs/start and @solidjs/router, and I attach the root.css file to the app.tsx file, so that the App should be able to use tailwindcss. When I click on a link from the A (import { A } from "@solidjs/router") Component, TailwindCSS is not present anymore.

Here is the gist of the file contents. I can't share the full repository due to credentials I have to clean up.

Note: The TailwindCSS example (from the example folder) is working as expected.

I am not sure what causes this bug to occur.

Expected behavior πŸ€”

I expected that the assets that are being prefetched are present (such as the tailwindcss from the imported root.css).

Steps to reproduce πŸ•Ή

As annoying as it may sound, you'll have to use the Gist to copy paste the important parts of the project.

Steps:

  1. Copy file contents form the gist
  2. My folder structure looks something like this (I stripped down not needed/unnecessary files):
    β”œβ”€β”€ app.tsx
    β”œβ”€β”€ components
    β”‚   β”œβ”€β”€ providers
    β”‚   β”‚   └── index.tsx
    β”‚   β”œβ”€β”€ PublicBlog.tsx
    β”‚   β”œβ”€β”€ PublicProject.tsx
    β”œβ”€β”€ entry-client.tsx
    β”œβ”€β”€ entry-server.tsx
    β”œβ”€β”€ global.d.ts
    β”œβ”€β”€ root.css
    β”œβ”€β”€ routes
    β”‚   β”œβ”€β”€ [...404].tsx
    β”‚   β”œβ”€β”€ blog
    β”‚   β”‚   β”œβ”€β”€ create.tsx
    β”‚   β”‚   └── [id]
    β”‚   β”‚       └── index.tsx
    β”‚   β”œβ”€β”€ index.tsx
    β”‚   └── project
    β”‚       β”œβ”€β”€ create.tsx
    β”‚       └── [id]
    β”‚           β”œβ”€β”€ configure.tsx
    β”‚           └── index.tsx
    └── utils
    β”œβ”€β”€ api
    β”‚   β”œβ”€β”€ blog.ts
    β”‚   β”œβ”€β”€ mutations.ts
    β”‚   β”œβ”€β”€ project.ts
    β”‚   β”œβ”€β”€ queries.ts
    β”‚   └── session.ts
    └── cn.ts
  3. Click on one of the links to move to another path
  4. TailwindCSS is present anymore.
  5. Refreshing helps to have TailwindCSS again.

Context πŸ”¦

I would like to have TailwindCSS across every page, without having to refresh the page, I want to have the ability to design the pages and components without constantly refreshing the pages.

Your environment 🌎

Node: v20.9.0
PNPM: 8.14.1

"@solidjs/router": "0.10.9"
"@solidjs/start": "0.4.10"
"solid-js": "1.8.11"
"vinxi": "^0.1.4"
ryansolid commented 6 months ago

If someone wants to spend the time frankensteining this into a working reproduction I'd be stoked. Otherwise there are a lot of other deps and things here and I'm not sure when I'd get around to it.

aseerkt commented 5 months ago

@oezguerisbert I am not seeing src directory in your folder structure.

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js,jsx,ts,tsx}"],
  theme: {
    extend: {},
  },
  darkMode: "class",
  plugins: [
    // default prefix is "ui"
    require("@kobalte/tailwindcss"),
    require("@tailwindcss/typography"),
  ],
};

As you can see here tailwindcss styles are only applied to the files mentioned in content

oezguerisbert commented 5 months ago

Sorry if I bring this comment up later than I should've. This issue is not occurring anymore with the latest version.