NextJS + Strapi - Custom layout and dynamic values #150
Replies: 3 comments 6 replies
-
Great :) Tip: I was using |
Beta Was this translation helpful? Give feedback.
-
This is awesome to see man! Congrats 🥳 we have also transitioned from Tailwind to Twind for a client recently so that we can accommodate composition more readily (using One thing I notice here (maybe you have already figured this out) is that Twind has // Template literals
tw`bg-gray-200 rounded`
//=> bg-gray-200 rounded
tw`bg-gray-200 ${false && 'rounded'}`
//=> bg-gray-200
// Strings
tw('bg-gray-200', true && 'rounded', 'underline')
//=> bg-gray-200 rounded underline
// Object syntax
tw({ 'bg-gray-200': true, rounded: false, underline: isTrue() })
//=> bg-gray-200 underline
tw({ 'bg-gray-200': true }, { rounded: false }, null, { underline: true })
//=> bg-gray-200 underline
tw({ hover: ['bg-red-500', 'p-3'] }, 'm-1')
// => hover:bg-red-500 hover:p-3 m-1
// Arrays
tw(['bg-gray-200', 0, false, 'rounded'])
//=> bg-gray-200 rounded
tw(['bg-gray-200'], ['', 0, false, 'rounded'], [['underline']])
//=> bg-gray-200 rounded underline
// Variadic
tw('bg-gray-200', [
1 && 'rounded',
{ underline: false, 'text-black': null },
['text-lg', ['shadow-lg']],
])
//=> bg-gray-200 rounded text-lg shadow-lg Taken from the docs here https://twind.dev/docs/modules/twind.html#tw-function |
Beta Was this translation helpful? Give feedback.
-
@sastan here is the site on production with |
Beta Was this translation helpful? Give feedback.
-
As anyone in the industry of making a lot of websites for clients sometimes the clients wants to use alternatives like:
But this packages has a high bundle size, with
twind
the thing is different. We always use Tailwind for all of our projects but sometimes the clients want a custom fontSize, color, etc that comes from Strapi (it's our backend by default) and now in one of our biggest project we are changing from emotion-js to usetwind
for all the applicationHere is a difference of what is looks like one of the components with styled vs
twind
And in the browser it's even more magical the way that is working 😍 we are waiting for the official release of the dynamic styles features to pass all the application to use only
twind
and leverage bundle size and also improve the development timeBeta Was this translation helpful? Give feedback.
All reactions