-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Example of twin inside an nx-workplace #38
base: master
Are you sure you want to change the base?
Conversation
Mammoth effort here, great job 💯 |
Could you let me know what you mean by theme and introducing a new lib? |
Of course. Theme "New Lib"
Imagine publishing your Custom Tailwind Configuration to NPM separately, I'm trying to ask: "Shall I put all of that in the example too?" |
I did a repository with nx, twin.macro and styled-components and I wanted to have a tailwind config by project. To do it I did the following script that I use in the babelMacro config property. Maybe it can help 😀 |
Interesting! I got something to work that was way dumber:
|
@mmmoli It would be awesome to add that a tailwind config setup like that to your nx example. Also - I wonder if we could use // libs/web-ui/babel-plugin-macros.config.js
+ const { resolve } = require("path");
module.exports = {
twin: {
preset: 'emotion',
+ config: resolve(__dirname, "tailwind.config.js"),
- config: 'libs/web-ui/tailwind.config.js',
},
};
// libs/web-ui/tailwind.config.js
module.exports = {
presets: [require('../tailwind-config')],
};
// libs/tailwind-config/package.json
{
"name": "@flua/tailwind-config",
"version": "0.0.1",
"main": "src/index.js"
} |
tw`hover:(scale-105)`, | ||
|
||
// Custom color from custom tailwind config | ||
tw`hover:(text-zabadoo)`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crucially, here's where we're using a custom value set in the theme.
theme: { | ||
extend: { | ||
colors: { | ||
zabadoo: 'blue', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's where we're defining a special variable, in this case, a brand colour called "zabadoo".
Hey @mmmoli, thanks for the work on this. I'm planning to take a good look into this in the next few days 👍 |
discussion from #20
See
apps/web/pages/index.tsx
for example usage.It's a minimal example that closely follows the rollup + component library in this repo.
What I'd really love, is to demonstrate how the theme can also be customised by introducing a new new
lib
.@ben-rogerson thoughts?