From 1c2dee0279bfc7cd89dbf675c9dfcb8172b0a7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?MUXW=5C=E7=A9=86=E6=99=93=E4=BC=9F?= Date: Wed, 6 Jul 2022 10:58:11 +0800 Subject: [PATCH] Allow incoming functions,Set multiple viewportWidths --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6419322..a1a519a 100755 --- a/index.js +++ b/index.js @@ -39,7 +39,10 @@ module.exports = postcss.plugin('postcss-px-to-viewport', function (options) { css.walkRules(function (rule) { // Add exclude option to ignore some files like 'node_modules' var file = rule.source && rule.source.input.file; - + // Allow incoming functions,Set multiple viewportWidths + if(typeof options.viewportWidth === 'function'){ + opts.viewportWidth = options.viewportWidth(file); + } if (opts.include && file) { if (Object.prototype.toString.call(opts.include) === '[object RegExp]') { if (!opts.include.test(file)) return;