简体   繁体   English

编译tailwindcss + typescript

[英]Compile tailwindcss + typescript

I have a very simple app with some html, css, and ts files.我有一个非常简单的应用程序,其中包含一些 html、css 和 ts 文件。 I use swc to compile the typescript and copy over the html/css/assets.我使用swc编译打字稿并复制 html/css/assets。 Now, I'm looking to add tailwind to my project, but I'm not sure how it will fit in to the build process.现在,我希望为我的项目添加顺风,但我不确定它将如何适应构建过程。

Currently, my build is very simple, I just run swc src -Dw --out-dir=built .目前,我的构建非常简单,我只运行swc src -Dw --out-dir=built However, I'm not sure of the interplay between swc and tailwind.但是,我不确定 swc 和顺风之间的相互作用。 Should I run tailwind first on my src directory, build into some intermediary directory, and then run swc in that directory?我应该先在我的 src 目录上运行 tailwind,构建到某个中间目录,然后在该目录中运行 swc 吗? Can tailwind even process ts files?顺风甚至可以处理 ts 文件吗?

All resources online seem to be tailored for people using react/nextjs with a complicated build system I don't understand.所有在线资源似乎都是为使用 react/nextjs 的人量身定制的,而且我不理解复杂的构建系统。

TailwindCSS is independent of SWC. TailwindCSS 独立于 SWC。 So you can run them both separately in either order.因此,您可以按任一顺序分别运行它们。 And you can run them both on the source files, not the compiled JavaScript.您可以在源文件上运行它们,而不是在编译后的 JavaScript 上。

I'd look into using the TailwindCSS CLI.我会考虑使用 TailwindCSS CLI。 The docs page for it outlines exactly how to import the resulting css into your simple app.它的文档页面准确地概述了如何将生成的 css 导入您的简单应用程序。 https://tailwindcss.com/docs/installation https://tailwindcss.com/docs/installation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM