skeletonlabs / skeleton

A complete design system and component solution, built on Tailwind.
https://skeleton.dev
MIT License
5.03k stars 321 forks source link

Theme Generator myCustomTheme #2815

Closed Bimbimz closed 2 months ago

Bimbimz commented 2 months ago

Link to the Page

https://www.skeleton.dev/docs/generator

Describe the Issue (screenshots encouraged!)

I have followed the guide but get an error message when using myCustomTheme. there are not enough tutorials on the internet for this.

tailwind.config.js

import { myCustomTheme } from './src/styles/CustomTheme'

plugins: [
    skeleton({
        themes: {
            custom: [
                myCustomTheme
            ]
        }
    })
]
Sarenor commented 2 months ago

While I would love to help you, we'd need some more information, like "whats the error message"?

endigo9740 commented 2 months ago

@Bimbimz we cover themes in detail in our documentation here:

https://www.skeleton.dev/docs/themes

But otherwise what Sarenor said - we need more information about what's happening to help you.

Bimbimz commented 2 months ago

this is the error message

[plugin:vite:css] [postcss] Cannot find module './src/styles/CustomTheme'

file name is CustomTheme.tsx i changed it to CustomTheme.ts and it works.

is it possible to create a file with the CustomTheme.jsx extension? and what does it contain?

endigo9740 commented 2 months ago

@Bimbimz that's correct, per our documentation we typically recommend .ts files for themes. To make sure we're on the same page:

There would be no immediate benefit of using JSX for theme files. They're a Javascript object that's provided to the Skeleton Tailwind plugin to access the settings within. This include colors, fonts, etc.

You linked to the Skeleton v2 theme generator, but note that Skeleton v2 only supports Svelte and Sveltekit as mentioned the Get Started information:

Screenshot 2024-08-15 at 11 35 18 AM

So let me ask - are you trying to use Skeleton v2 within a React project? If so that's possible, but not officially supported by us. However, we're currently working on developing Skeleton v3, which will have full support for React and Next.js. If you're curious about that, you can learn more here:

Just note that Skeleton v3 is in an early pre-release state right now and not ready for production use.

Bimbimz commented 2 months ago

i want to use the latest version. i have v2 by running this by default: npm i -D @skeletonlabs/skeleton @skeletonlabs/tw-plugin

does v3 support Svelte? i use react a lot, and these days trying svelte.

endigo9740 commented 2 months ago

Ok, the latest package releases for Skeleton v2 are as follows:

You can run npm list to verify your installed versions.

For Skeleton v3 - one of the primary goals is to support Svelte 5, which introduces some new component APIs and features. At launch we'll be supporting Svelte 5 and React, but we do hope to introduce other frameworks over time.

endigo9740 commented 2 months ago

Also I think the original issue raised has been resolved, so I'll go ahead and close out this issue. If you have further questions feel free to reach out here (I'll see new posts). Thanks!