如何在tailwindcss中禁用或清除非类类型

huangapple go评论75阅读模式
英文:

How to disable or purge non-class types in tailwindcss

问题

在我的项目中,我想在 PHP 中运行一个 Svelte 捆绑(使用 Rollup),并使用 Tailwind CSS 来配置该捆绑的类。

问题是,我不知道 Tailwind 做了很多元素选择器样式(例如 body、h1、table 等),而 PHP 项目已经有了默认选择器样式的 CSS 文件,我打算使用它们。

有没有办法忽略 Tailwind CSS 中的所有选择器样式,或者让它在捆绑中隔离(捆绑正在加载到一个 div 中)?

英文:

So on my project, I want to run a svelte bundle (using rollup) inside a PHP and use tailwindcss to configure the classes of that bundle.

The problem is that I didn't know tailwind does a lot of element selector styling (body, h1, table etc.) and the PHP project already has css files that has default selector style that I plan to use.

Is their a way to ignore all of the selector style in tailwindcss or a way to make it isolated within the bundle (the bundle is being loaded inside a div)

答案1

得分: 1

元素选择器规则来自Tailwind的preflight核心插件。根据文档的说明,您可以像禁用其他核心插件一样,在tailwind.config.js中禁用它:

module.exports = {
  corePlugins: {
    preflight: false,
  }
}
英文:

The element selector rules are from Tailwind's preflight core plugin. As per the documentation, you can disable it like any other core plugin, in tailwind.config.js:

module.exports = {
  corePlugins: {
    preflight: false,
  }
}

huangapple
  • 本文由 发表于 2023年5月26日 08:03:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76336892.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定