twin.examples icon indicating copy to clipboard operation
twin.examples copied to clipboard

Example of twin inside an nx-workspace with styled components

Open anymaniax opened this issue 3 years ago • 9 comments

Based on #38 I did an example with styled-components. I added my scripts to handle multiple projects and add preset from a library

anymaniax avatar Mar 09 '21 20:03 anymaniax

❤️ that we're coming at this from different side.

FYI: I just pushed an example with tailwind-config as a separate, buildable nx lib.

It'd be great to get your thoughts and find an identical approach.

I can shoot first: it SUCKS that my tailwind-config lib has to be a js module. I can't get it to work in ts and it makes me 😭

mmmoli avatar Mar 10 '21 14:03 mmmoli

@mmmoli I don't know if you saw I also created a function to automatically get preset from another NX library and I use it to get preset from my UI library. You can see it here. I think that way it's really customizable

anymaniax avatar Mar 10 '21 19:03 anymaniax

@anymaniax link's broken.

I see it here: https://github.com/ben-rogerson/twin.examples/blob/40b72ecb875b0610ddcb0a50c9a0d3d055df6b59/nx-workspace-styled-components/apps/web/tailwind.config.js

mmmoli avatar Mar 11 '21 12:03 mmmoli

Thanks heaps for adding the styled-components version of this @anymaniax

I'll support whichever way you guys want to head with an identical preset approach. Personally, I'd shy away from adding custom functions in an example starter - but only if the same functionality can be provided in a simple way.

ben-rogerson avatar Mar 11 '21 20:03 ben-rogerson

How about buildable libraries?

For now it seems like not working properly, because of ReferenceError: tw is not defined Снимок экрана 2021-04-17 в 8 59 02 PM

Crisis2010 avatar Apr 17 '21 17:04 Crisis2010

Is there a recommended example repo to start from? Was hoping to use NX workspaces with twin and stitches if possible. Thanks for any pointers.

alanontheweb avatar Jun 21 '21 05:06 alanontheweb

We haven't quite got a nx-workspace example through yet so you'll need to give one of these PR's a pilot test 🤞

ben-rogerson avatar Jun 24 '21 21:06 ben-rogerson

What is the status of this PR? Would love to see an example on how to get started with NX!

Is there anything to do to help with this?

nonameolsson avatar Mar 09 '22 08:03 nonameolsson

@nonameolsson I feel this example has too many files and features for a twin example. If it were simplified (remove cypress/jest/etc configs?) then it could join the others.

ben-rogerson avatar Mar 16 '22 20:03 ben-rogerson