PostHtml 中的一些有用的插件

记录一下 PostHtml 中的一些比较有用的插件
参考自PostHtml文档

posthtml-pug

将pug转化成html

posthtml-md

将md语法转化为html语法

posthtml-retext

根据规则转化自然语言(例如特定字符串转成emoji表情)

posthtml-head-elements

将JSON配置生成head元素内容

posthtml-include

引入html片段(实现html的模块化)

posthtml-modules

同上,而且她能实现vue中slot的效果

posthtml-inline-assets

将外部的css、js、图片等资源内联进html

posthtml-cache

在某标签的某属性值后增加随机查询参数,如

<script src="script.js"></script>
<!-- 处理后 -->
<script src="script.js?v=93ce_Ltuub"></script>

posthtml-spaceless

删除指定区域内标签之间的空格

posthtml-postcss

使用postcss处理html内的样式(style标签和内联样式)

posthtml-px2rem

在html内使用px2rem处理style标签和内联样式

posthtml-inline-css

可将外部样式或style标签内样式弄成内联样式

posthtml-collect-inline-styles

可将内联样式提取到style标签内

posthtml-style-to-file

可将内联样式和style标签内样式提取到独立文件内

posthtml-color-shorthand-hex-to-six-digit

将缩写的hex color转化成6个字符的格式

posthtml-minifier

压缩

htmlnano

同上

posthtml-remove-attributes

根据属性名或值去除指定属性

posthtml-remove-tags

去除指定名称的标签

Posthtml-remove-duplicates

根据标签名删除内容完全一样的标签

posthtml-transfomer

1.将标记的引用外部文件的script或link标签的内容,内联进html
2.将标记的标签删除
3.将标记的多个引用外部文件的script或link标签的内容,内联进html内的同一标签内

posthtml-tidy

整理html、清理无用的标签

猜你喜欢

转载自www.cnblogs.com/JRliu/p/9160440.html