Giter Site home page Giter Site logo

Deno support about twind HOT 9 CLOSED

tw-in-js avatar tw-in-js commented on August 22, 2024
Deno support

from twind.

Comments (9)

sastan avatar sastan commented on August 22, 2024 1

I probably don't know enough about how to use SSR to answer all of this :) but this sounds reasonable :)

Why did you then try to import twind/server?

as for async_hooks, I have no idea what that is, but from a quick look at docs it seems like it's experimental and there are no plans to support it in Deno any time soon denoland/deno#945

Thanks. Good to know.

also if it's experimental with node.js it seems that twind/server is going to have 3 environments it might run: old node.js with no async_hooks support, new node.js, and Deno :) and only 1 of those 3 is going to work :)

twind/server is only required for async rendering in node.js environment where we test it and it works in v12 and v14 which is good enough for the moment. Additionally we have a notice on top of that doc section. Deno/Node sync rendering of shimmed html should now work by using twind/shim/server.

I'll adjust the docs to make clear that for sync rendering twind/sheets and for the shim twind/shim/server is enough.

from twind.

sastan avatar sastan commented on August 22, 2024 1

Why did you then try to import twind/server?

that's the only thing that is mentioned in https://github.com/tw-in-js/twind/blob/main/docs/ssr.md :)

For sync rendering twind/sheets is used. But the header is misleading. Maybe you could provide an PR to fix that 😉

Deno/Node sync rendering of shimmed html should now work by using twind/shim/server

It is not released. We have two other PR we want to include in the next release.

from twind.

sastan avatar sastan commented on August 22, 2024 1

Release v0.12.0 is published. twin/sheets/server should now work in deno

from twind.

bebraw avatar bebraw commented on August 22, 2024 1

@aadamsx I have a small example at https://github.com/bebraw/gustwind . It seems to work without shim and sheet.reset though this definitely needs more experimentation.

from twind.

sastan avatar sastan commented on August 22, 2024

twind/server is meant to be run only on node js as one of it export is the asyncVirtualSheet which uses async_hooks. The other export is the server side shim method. Sadly this way one can not use shim outside of nodejs.

What about we create twind/shim/server module that exports the shim method? This way you would only need to use twind/server if you want to use the asyncVirtualSheet. All other exports are only re-exports from twind/sheets and could be imported from there. twind/server would still re-export shim from twind/shim/server.

Would this help:

import { shim } from 'twind/shim/server'
import { virtualSheet, getStyleTag } from 'twind/sheets'

// ...

For now that would mean no async rendering for deno. Do you know if there is an async_hooks equivalent?

from twind.

JLarky avatar JLarky commented on August 22, 2024

I probably don't know enough about how to use SSR to answer all of this :) but this sounds reasonable :)

as for async_hooks, I have no idea what that is, but from a quick look at docs it seems like it's experimental and there are no plans to support it in Deno any time soon denoland/deno#945

also if it's experimental with node.js it seems that twind/server is going to have 3 environments it might run: old node.js with no async_hooks support, new node.js, and Deno :) and only 1 of those 3 is going to work :)

from twind.

JLarky avatar JLarky commented on August 22, 2024

Why did you then try to import twind/server?

that's the only thing that is mentioned in https://github.com/tw-in-js/twind/blob/main/docs/ssr.md :)

Deno/Node sync rendering of shimmed html should now work by using twind/shim/server

https://esm.sh/twind/shim/server crashes :)
https://jspm.dev/twind/shim/server is 404
https://cdn.skypack.dev/twind/shim/server is 404

from twind.

aadamsx avatar aadamsx commented on August 22, 2024

Is there an example repo where somewhere I can see how tailwind is properly integrated with Deno?

from twind.

sastan avatar sastan commented on August 22, 2024

It should "just" work – except for twind/server that is using a node specific package (async_hooks). Do you have any issues?

from twind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.