当我启动现场服务器时,tailwindcss课程不会反映

发布于 2025-01-23 18:35:44 字数 605 浏览 2 评论 0原文

这是我第一次尝试使用tailwind CSS,这是一个麻烦,试图将其设置为几天而没有成功的情况,遵循了绝对初学者的YouTube视频,直到最后一切都很好,直到加载实时服务器和课程刚刚赢得冠军' t反映。让我提到,我还没有学到任何JS框架。我还尝试了来自THIR网站的官方逆风设置和使用Vite的官方YouTube视频,但仍然没有运气。

我的postcss.config.js文件

module.exports = {
  plugins: [require("tailwindcss"), require("autoprefixer")],
};

我的尾风配置

module.exports = {
  content: [],
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
};

我也有反映在输出文件中的CSS中,我添加了此导入,因为有人在这里建议它

@import "tailwind/base";
@import "tailwind/components";
@import "tailwind utilities";

This is my first time trying to use tailwind css and its been a hassle trying to set it up for days now without success, followed a youtube video for absolute beginners till the end everything was fine until time to load live server and classes just won't reflect. Let me mention that i have not learned any js framework just vanilla. i have also tried the official tailwind setup from thier websites and thier official youtube videos which uses vite, still no luck.

my postcss.config.js file

module.exports = {
  plugins: [require("tailwindcss"), require("autoprefixer")],
};

my tailwind config

module.exports = {
  content: [],
  theme: {
    extend: {},
  },
  variants: {},
  plugins: [],
};

i also have this in css which is reflected in the output files, i added this import because someone advised it here and still didnt work

@import "tailwind/base";
@import "tailwind/components";
@import "tailwind utilities";

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾挽 2025-01-30 18:35:44

您需要告诉tailwind.config.js它应该分发到什么内容。
内容:[“ ./src/pages/*。{html,js}”],例如。路径必须相对于tailwind.config.js所在的位置。

您还需要使用Tailwind的实时汇编手表模式,该模式解析内容:所有使用过的CSS类的文件,将它们编译为output.css。在您的HTML中,您只需要包括output.css

命令像这样:
npx tailwindcss -i/path/to/input.css -o/path/to/output.css -watch

input.css是您的原始CSS文件(您的位置'将@import)和output.css是每次使用二手类生成的文件,因此您将加载到HTML上的文件。

You need to tell tailwind.config.js what content it should distributes to.
content: ["./src/pages/*.{html,js}"], for example. The path has to be relative to where tailwind.config.js is.

You will also need to uses the live compilation watch mode of Tailwind, which parses content: files for all used CSS classes, compiles them into output.css. In your HTML, you'll just have to includes that output.css

The command goes like that:
npx tailwindcss -i /path/to/input.css -o /path/to/output.css --watch

input.css being your original css file (where you've put the @import), and output.css being the file it'll generates each time with the used classes, so the file you'll load onto your HTML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文