在雨果网站中使用Tw-elements
我想在雨果网站上添加旋转木马,所以我试图使用Tw-elements。我已经使用了他们的快速启动指南,然后将TW-Elements插件放入插件部分tailwind-config.js文件,但脚本未导出到公共文件夹。有人做过吗?我想念什么步骤? 谢谢!
I want to add a carousel in a Hugo site, so I'm trying to use tw-elements. I have used their quick start guide and put the tw-elements plugin in the plugins section of the tailwind-config.js file, but the script isn't exported to the public folder. Has anyone done this before? What step(s) am I missing?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
仅将
tailwind-config.js
文件放在雨果中就不够了。您需要:style.css
使用Assets/
或static/
目录中的tailwind样式中。 CSS
由Tailwind生成的雨果(例如< head></head>
部分,例如在baseof.html模板中。请参阅此处,以获取有关将Hugo与Tailwind集成的完整指南:
https://www.unsungngovelty.org/posts/03/2022/how-to-to-to-x-add-tailwind-css-3-to-a-a-a-hugo-website-in-20222/
noreferrer “ 通过将以下行放入
< head></head>
部分:Just putting the
tailwind-config.js
file in Hugo won't be enough. You need to:style.css
using Tailwind in yourassets/
orstatic/
directorystyle.css
generated by Tailwind into Hugo, for example in<head></head>
section, for example in the baseof.html template.See here for a complete guide on integrating Hugo with Tailwind:
https://www.unsungnovelty.org/posts/03/2022/how-to-add-tailwind-css-3-to-a-hugo-website-in-2022/
An alternative is to use Tailwind CDN by putting the following line in the
<head></head>
section of your site:使用命令行首次设置项目
使用雨果创建自己的主题
激活您的主题:在您的根部打开Hugo.toml(或Hugo.yaml)文件Hugo站点并添加或更新主题配置:在FrontMatter中添加此
package.json
使用install
tailwindcss
及其同行依赖性通过NPM创建您的tailwind.config .js文件。因此,现在我们必须在我们的主题目录和一个样式中创建tailwind和Postcss配置文件。CSS文件,该文件充当CSS输出文件
现在,让我们配置我们的Postcss配置文件,以便打开PostCSSS 。
打开我们以前创建的
在Head Tag中导入CSS的style.CSS文件
当我们创建新主题时,Hugo通过创建一些启动模板文件来帮助我们。这些入门文件之一是head.html部分。
此文件的位置
您的website-name/themes/your-theme-name/layouts/partials
添加此行head.html文件,元标记
现在转到baseof.html文件在
Body
标签中添加一些HTML元素并使用尾风类。
在
您的website-name/content
文件夹中创建一些标记文件,请访问该页面,查看您的页面是否看起来像baseof.html文件,如果遇到任何错误,可能是由于错别字,无论是从您的身边还是我的。检查拼写,如果发生其他错误,请在评论中告诉我。
First set-up your project using command line
Create your own theme using hugo
Activate Your Theme: Open the hugo.toml (or hugo.yaml) file in the root of your Hugo site and add or update the theme configuration: Add this in frontmatter
Now initailize
package.json
file usingInstall
tailwindcss
and its peer dependencies via npm, and create your tailwind.config.js file.So, now we have to create tailwind and postcss config file in our theme directory and one style.css file which is act as css output file
Now let's configure our postcss config file so open up postcss.config.js
Now let's configure our tailwind config file so open up tailwind.config.js
Add the Tailwind directives to your CSS:
open up style.css file that we created previously
Importing CSS in head tag
When we created our new theme, Hugo helped us out by creating some starting templates files. One of these starter files is the head.html partial.
location of this file
your-website-name/themes/your-theme-name/layouts/partials
Add this line head.html file after meta tag
Now go to baseof.html file add some html element inside
body
tagand use tailwind class.
create some markdown file in
your-website-name/content
folder visit that page see if your page is look like baseof.html file with some content of your markdown file or notIf you encounter any errors, it may be due to typos, either from your side or mine. Check spelling and if any other error happen please let me know in comment.