当我启动现场服务器时,tailwindcss课程不会反映
这是我第一次尝试使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要告诉
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 thatoutput.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), andoutput.css
being the file it'll generates each time with the used classes, so the file you'll load onto your HTML.