$ cnpm install wxml-minifier

微信小程序 WXML 压缩工具
npm i -D wxml-minifier
minifier(resource[, options])
const minifier = require('wxml-minifier')
const wxmlStr = `
<view class="home" >
<!-- test -->
</view>
`
const minified = minifier(wxmlStr)
console.log(minified) // <view class="home></view>
| 名称 | 类型 | 默认值 | 功能 |
|---|---|---|---|
| whitespace | Boolean |
true |
移除 wxml 多余的空格 |
| comment | Boolean |
true |
移除所有的注释 |
Copyright 2013 - present © cnpmjs.org | Home |