如何将外部CSS导入后风的app.css
我正在尝试使用第三方node_nodules,其中包含我尝试以各种方式导入tailwinds app.cs.cs.css.css的CSS。 Tailwind CSS的东西正在进口和工作正常。
关于我做错了什么的想法?
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
/* DID NOT WORK: */
/* @import '/node_modules/swiper/swiper-bundle.css';
@import '/node_modules/swiper/swiper-bundle.min.css';
@import '/node_modules/swiper/swiper.min.css'; */
/* DID NOT WORK: */
/* @import 'swiper/swiper-bundle.css';
@import 'swiper/swiper-bundle.min.css';
@import 'swiper/swiper.min.css'; */
/* DID NOT WORK: */
/* @import '~swiper/swiper-bundle.css';
@import '~swiper/swiper-bundle.min.css';
@import '~swiper/swiper.min.css'; */
我的post.config.js看起来像这样:
module.exports = {
plugins: {
'postcss-import': {},
tailwindcss: {},
autoprefixer: {},
},
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定是否已经回答,但是我发现使用PostCSS-Import与Tailwind(也使用Remix Vite Spa)解决了我的问题。在Postcss.config.js文件中,请确保您有以下内容:
从那里开始,请确保您正确设置了您的导入,因为这确实使用了严格的CSS导入,如下所示: https://tailwindcss.com/docs/using-with-preprocessors#build time-imports 。
因此,我的tailwind.css(主要CSS文件)看起来像:
图书馆风格的文件夹既有尾风基类,又保存着我从混音github中撕下的样式。 tailwindbase.css文件看起来像我的应用程序:
Not sure if this has been answered yet or not, but I found that using postcss-import with tailwind (also using Remix Vite SPA) resolved my problems. In the postcss.config.js file, make sure you have the following:
From there, make sure you setup your imports correctly as this does use strict CSS importing as detailed here: https://tailwindcss.com/docs/using-with-preprocessors#build-time-imports.
So, my tailwind.css (main css file) looks like this:
Where the libraryStyles folder holds both the tailwind base classes and the style I ripped from the remix github. The tailwindbase.css file looks like this for my app:
只需在input.css中添加一行:
Just add one line in input.css: