twig - Twig - 在子组件中使用 TailwindCSS 的 @apply
问题描述
我正在尝试@apply
在子组件中使用 TailwindCSS,但它不应用样式。
{% extends 'base.html.twig' %}
{% block stylesheets %}
{{parent()}}
<style>
h2 {
@apply text-3xl;
}
</style>
{% endblock %}
{% block body %}
<div class="container mx-auto text-dark-shade">
{% block content %}{% endblock %}
</div>
{% endblock %}
使用标准 CSS 它可以工作并应用样式。
{% extends 'base.html.twig' %}
{% block stylesheets %}
{{parent()}}
<style>
h2 {
font-size: 3rem;
}
</style>
{% endblock %}
{% block body %}
<div class="container mx-auto text-dark-shade">
{% block content %}{% endblock %}
</div>
{% endblock %}
显示h2
在内容块中,它用于重复使用几次的组件。
解决方案
推荐阅读
- android - 当应用程序在后台或在 FCM 服务中被杀死时如何处理多个通知
- entity-framework - 如何在两个具有一对一关系的表之间建立关系
- javascript - 在后续脚本运行 Javascript 中将值设置为同一列中的下一行
- r - R 不断为我的随机森林模型崩溃,因为我想种植 10,000 棵树并且 do.omit 为 1,000
- tinymce-4 - TinyMCE 4.9.6 TinyMce.min.js 文件获取错误消息
- gremlin - Gremlin Python:在一个查询中计算顶点及其子项
- react-native - 在 react-native 0.60.5 中,无法从内部渲染方法调用类函数
- python - 如何将颜色从 HSV 更改回 RGB
- c# - 绑定到 System.Windows.Forms.TreeNode 集合的 WPF TreeView 不显示任何内容
- python - 如何找到每个数字中有多少个数字Python