exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework
https://ultrajs.dev
MIT License
2.99k stars 66 forks source link

create: update twind to 1.0 #216

Closed deckchairlabs closed 1 year ago

deckchairlabs commented 1 year ago

We need to update the create script to use the new twind 1.0 release

cdoremus commented 1 year ago

I'm working on a blog post about Ultra with an example app based on the current create script and here's my guide how to upgrade what the create script produces when twind is selected to twind 1.0:

Upgrading to twind 1.0 from 0.16.17

importMap.json

const styleElementId = "__twind";

export const sheet = typeof Deno === "undefined" ? cssom(style#${styleElementId}) : virtual();

export const stringify = (target: unknown) => <style id="${styleElementId}">${stringify$(target)}</style>;

//@ts-ignore twind type issue export const tw = twind( config, sheet, );

export const tx = tx$.bind(tw); export const injectGlobal = injectGlobal$.bind(tw); export const keyframes = keyframes$.bind(tw);


## src/twind/TwindProvider.tsx

- delete this file

## src/twind/twind.config.js

- create this file and add the following content:
```js
import { defineConfig } from "@twind/core";
import presetAutoprefix from "@twind/preset-autoprefix";
import presetTailwind from "@twind/preset-tailwind";

export default defineConfig({
  theme: {
  // add theme styles here
  },
  presets: [presetAutoprefix(), presetTailwind()],
});

client.tsx

server.tsx

app.tsx

Any file that uses twind/tailwind styles:

M1racle04 commented 1 year ago

hii can i work on this?

deckchairlabs commented 1 year ago

hii can i work on this?

Please do!

cdoremus commented 1 year ago

Yes, do it! I don't have time right now myself.

M1racle04 commented 1 year ago

Created couple of prs, please check

cdoremus commented 1 year ago

This issue deals with updating the create.ts script used to initialize a new Ultra project. The notes I put above are changes that need to be made inside the lib/create folder.