跳到主要内容

🧩 文件匹配

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/index.ts:13

本页收录 6 个配置项,来源于 UserDefinedOptions

配置一览

配置项类型默认值说明
htmlMatcher(name: string) => boolean匹配需要处理的 wxml 等模板文件。
cssMatcher(name: string) => boolean匹配需要处理的 wxss 等样式文件。
jsMatcher(name: string) => boolean匹配需要处理的编译后 js 文件。
mainCssChunkMatcher(name: string, appType?: AppType) => boolean匹配负责注入 Tailwind CSS 变量作用域的 CSS Bundle。
wxsMatcher(name: string) => boolean()=>false匹配各端的 wxs/sjs/.filter.js 文件。
inlineWxsbooleanfalse是否转义 wxml 中的内联 wxs

详细说明

htmlMatcher

可选 | 类型: (name: string) => boolean

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:9

匹配需要处理的 wxml 等模板文件。

参数

name

string

返回

boolean

cssMatcher

可选 | 类型: (name: string) => boolean

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:15

匹配需要处理的 wxss 等样式文件。

参数

name

string

返回

boolean

jsMatcher

可选 | 类型: (name: string) => boolean

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:21

匹配需要处理的编译后 js 文件。

参数

name

string

返回

boolean

mainCssChunkMatcher

可选 | 类型: (name: string, appType?: AppType) => boolean

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:29

匹配负责注入 Tailwind CSS 变量作用域的 CSS Bundle。

备注

在处理 ::before/::after 等不兼容选择器时,建议手动指定文件位置。

参数

name

string

appType?

AppType

返回

boolean

wxsMatcher

可选 | 类型: (name: string) => boolean | 默认值: ()=>false

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:40

匹配各端的 wxs/sjs/.filter.js 文件。

备注

配置前请确保在 tailwind.config.jscontent 中包含对应格式。

默认值

()=>false

参数

name

string

返回

boolean

inlineWxs

可选 | 类型: boolean | 默认值: false

定义于: packages/weapp-tailwindcss/src/types/user-defined-options/matcher.ts:65

是否转义 wxml 中的内联 wxs

备注

使用前同样需要在 tailwind.config.js 中声明 wxs 格式。

默认值

false

示例

<!-- index.wxml -->
<wxs module="inline">
// 我是内联wxs
// 下方的类名会被转义
var className = "after:content-['我是className']"
module.exports = {
className: className
}
</wxs>
<wxs src="./index.wxs" module="outside"/>
<view><view class="{{inline.className}}"></view><view class="{{outside.className}}"></view></view>