@moohng/postcss-px2vw
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -27,5 +27,6 @@ 'use strict'; | ||
if (opts.viewportWidth) { | ||
decl.parent.insertBefore(i, decl.clone({ | ||
value: value.replace(pxRegex, pxReplaceForRem) | ||
})); | ||
var newValue = value.replace(pxRegex, pxReplaceForRem); | ||
if (newValue !== value) { | ||
decl.parent.insertBefore(i, decl.clone({ value: newValue })); | ||
} | ||
} else { | ||
@@ -32,0 +33,0 @@ decl.value = value.replace(pxRegex, pxReplaceForRem); |
{ | ||
"name": "@moohng/postcss-px2vw", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A CSS post-processor that converts px to vw and fallback rem.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,3 +5,3 @@ # postcss-px2vw | ||
该插件主要结合了 [postcss-pxtorem](https://github.com/cuth/postcss-pxtorem) 和 [postcss-px-to-viewport](https://github.com/evrone/postcss-px-to-viewport) 的功能,精简了不常用的配置。默认将 `vw` 作为优选单位使用,以 `rem` 作为回退模式。考虑到 `vw` 在一些老旧设备上支持不够理想,这款插件很好的解决了该问题。 | ||
该插件主要结合了 [postcss-pxtorem](https://github.com/cuth/postcss-pxtorem) 和 [postcss-px-to-viewport](https://github.com/evrone/postcss-px-to-viewport) 的功能,精简了不常用的配置。默认将 `vw` 作为优先单位使用,以 `rem` 作为回退模式。考虑到 `vw` 在移动设备的支持度不如 `rem`,这款插件很好的解决了该问题。 | ||
@@ -20,3 +20,3 @@ ## 安装 | ||
plugins: { | ||
'postcss-px2vw': {} | ||
'@moohng/postcss-px2vw': {} | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
## 致谢 | ||
## 最后 | ||
@@ -61,0 +61,0 @@ 如果你觉得对你有帮助,欢迎 star 和 issue |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5423
46