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
custom color in tailwind config file not being recognized #80
Comments
Hey @vital-tech-results, can you please run the official Tailwind CLI on your project to generate a .css file to see if it includes your custom colours? Which version of the library are you using as well? |
Thanks for the quick reply @marklawlor I'm running the following:
Apologies, I'm not sure what you meant by "which version of the library" I am using. I guess you mean your nativewind nom package? I will look into the official Tailwind CLI you mentioned. |
I looked at the official docs but I'm not sure how to build on a react-native project built using expo SDK. I will keep looking. The docs say:
but this appears to target a single CSS file and output it into a |
That command is correct. This library converts the CSS generated by the official tool into RN code - so if you don't see your custom class in the .css output then it's not being processed by RN either. The |
I may be confused but my project doesn't have
I replaced However, I don't see a file called Attached is a screenshot of my project structure. Thank you, DJ |
@vital-tech-results Let's take a couple of steps back and do troubleshooting 101: Does it work in a Hello World example. Can you please follow the instructions in the quick start guide to create a new project with your custom color. If this doesn't work can you please post that code in a public repo. If it does work, the only difference between the Hello World example and your main project should be the If your content is not correct, Tailwind CSS will not work - hence this library will not work. In the examples I use |
I installed a fresh project using the Thanks for your support. This is a very practical package that solves a real problem. Thanks for creating this package. |
Thanks for the support 💯 I'm going to close this issue as there doesn't appear to be an issue with custom colors, but you can still respond with questions if you need help debugging. |
@vital-tech-results did you find what the problem was in your code? Running into the same issue. |
Yes, I had to modify the Just like @marklawlor mentioned: If it does work, the only difference between the Hello World example and your main project should be the content setting of your If your content is not correct, Tailwind CSS will not work - hence this library will not work. In the examples I use |
Checked and double checked the config, I'm sure the right files are included. Since it's working for you, I'm sure it must be something on my side. But the strange thing is, if I switch back to using the To clarify, with 'it doesn't work' I mean that when I define a custom color 'primary', and add the className |
@fikkatra Can you publish a repo with a demonstration of your issue, I cannot replicate it on a new project. Changing between You can test your projects configuration directly with Tailwind CLI. Run |
@marklawlor thanks a lot for looking into it. Here's a minimal repro: https://github.com/fikkatra/nativewind-repro I can confirm that |
@fikkatra Can you try version |
Using the mentioned version. Stil same issue.
|
Instead of commenting "same here" can you please share either your |
My apologies, I edited the comment. |
Custom colors worked after hard cleaning the proj For Windows
|
I can confirm that with version |
Is there a way to import the colors from a typescript file into tailwind.config.js? Here is my colors.ts file
And here is my tailwind.config.js
It works for importing .js file like brandTheme for example but not typescript, now I need the same code of my colors inside tailwind.config.js and colors.ts to bypass this error |
No, Tailwind CSS only understands If you'd like types in your colors file, just add them via comments https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html |
Thank you for your answer, is there a way to make my theme.js readable in my typescript project?
in my
my theme.js file look like this
|
@marklawlor really appreciate your help, but I'm not able to make it work as I can't import .js files into my projects,
I keep getting the same error as above
Do I need to make extra changes in my babel.config.js or tsconfig.json? |
Your importing Unless you are using ESM, you do not include the file extension when importing files. |
Still not working, when removing the file extension as you mentioned
|
This doesn't appear to be an issue with NativeWind, an unfortunately I do not have the capacity to debug your project. I would recommend following simple troubleshooting:
Then you can use simple isolation techniques to find your cause. |
this is also happening on version 2.011 @marklawlor |
@wizevlad Please provide a code example. This issue has been resolved, all other reports I have received have been human error |
Everything works great on this package. The docs are clear and helpful. I only have one issue. When I add a custom color to
tailwind.config.js
it's not registering. I've restarted expo but still doesn't work. This is my config file for tailwind:Do you have any suggestions? It's running
expo 5.4.11
react-native": "0.68.2
react": "17.0.2
The text was updated successfully, but these errors were encountered: