Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
oezguerisbert opened this issue Jan 19, 2024 · 3 comments
Closed
2 tasks done

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

oezguerisbert opened this issue Jan 19, 2024 · 3 comments
Labels
bug Something isn't working needs reproduction issue needs a reproduction

Comments

@oezguerisbert
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the 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
  1. Click on one of the links to move to another path
  2. TailwindCSS is present anymore.
  3. 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"
@oezguerisbert oezguerisbert added the bug Something isn't working label Jan 19, 2024
@ryansolid
Copy link
Member

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.

@ryansolid ryansolid added the needs reproduction issue needs a reproduction label Feb 12, 2024
@aseerkt
Copy link

aseerkt commented Mar 25, 2024

@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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs reproduction issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants