Closed brandonxiang closed 5 years ago
我试了一下,不兼容3.0.0版的gulp-posthtml,可以在1.5.2版使用,希望能升级
好的我来跟一下
尝试升级gulp-posthtml到3.0.0,可惜posthtml-px2rem不兼容,盼望能升级
var posthtml = require('gulp-posthtml');
var posthtmlPx2rem = require('posthtml-px2rem');
gulp.src(paths.src.html)
.pipe(posthtml(
[posthtmlPx2rem({rootValue: 20, minPixelValue: 2})]
))
.pipe(gulp.dest(paths.dist.dir));
这样用就兼容了,需要多加一对中括号
也可以这样
.pipe(gulpif(
config.supportREM,
posthtml(
[ require('posthtml-px2rem')({rootValue: 20,minPixelValue: 2}) ]
))
)
@xuCesar @brandonxiang 是新版的 posthtml 的接口语法变化导致的,新版本对于同时使用多个插件的支持度变得更好了,我们这个插件在他们首页也有索引,目前我们团队内部使用一切正常。
出现错误信息,
但是如果输入一个页面,则不会出错。