Wechat applet compresses wxml

Background: After the WeChat applet added webpack compression, it supported js, css and other compression, but wxml did not find the corresponding api. Later, I saw that the applet can start custom compilation commands, and found some commands to achieve wxml compression. The records are as follows, and the partners who need it can pick it up by themselves.

The command input position is as follows:

The command is as follows, which can be copied directly:

find . -type f -name "*.wxml" -print0 | xargs -0 perl -pi -e  "s/^\s*/ /g";
find . -type f -name "*.wxml" -print0 | xargs -0 perl -pi -e  "s/\n//g";
find . -type f -name "*.wxml" -print0 | xargs -0 perl -pi -e  "s/> </></g";
find . -type f -name "*.wxml" -print0 | xargs -0 perl -pi -e  "s/<!--(.|[\r\n])*?-->//g";

The code compression of wxml can be realized above, and interested friends can try it to see the effect! 

Guess you like

Origin blog.csdn.net/wh_xmy/article/details/125478801