vite-plugin-style-to-vw
Advanced tools
Comparing version 1.8.1 to 1.8.2
import { Plugin } from 'vite'; | ||
interface IdefaultsProp { | ||
allReplace:boolean, | ||
allReplace?:boolean, | ||
unitToConvert?: string, | ||
@@ -6,0 +6,0 @@ viewportWidth?: number, |
{ | ||
"name": "vite-plugin-style-to-vw", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"description": "一个可以将签内样式px转换vw的plugin", | ||
@@ -5,0 +5,0 @@ "exports": { |
import { Plugin } from "vite"; | ||
export interface IdefaultsProp { | ||
allReplace:boolean, | ||
allReplace?:boolean, | ||
unitToConvert?: string, | ||
@@ -5,0 +5,0 @@ viewportWidth?: number, |
@@ -48,3 +48,6 @@ import type { IdefaultsProp } from './index.d' | ||
function vitePluginStyleToVw(customOptions: IdefaultsProp = defaultsProp) { | ||
customOptions = Object.assign(defaultsProp, customOptions) | ||
// 合并 | ||
const copyDefaultsProp = Object.assign({}, defaultsProp) | ||
// 生成自定义 | ||
customOptions = Object.assign(copyDefaultsProp, customOptions) | ||
try { | ||
@@ -186,2 +189,3 @@ // 异步写入文件 | ||
try { | ||
// 读取文件,node端生成合并的配置, | ||
const json = await import('./file.json') | ||
@@ -196,3 +200,4 @@ extraOptions = json.default | ||
export const stylePxToVw = (code: string | number, customOptions: IdefaultsProp = {}) => { | ||
customOptions = Object.assign(extraOptions, customOptions) | ||
const copyExtraOptions = Object.assign({}, extraOptions) | ||
customOptions = Object.assign(copyExtraOptions, customOptions) | ||
if (typeof code === 'number' || (typeof Number(code) === 'number' && !isNaN(Number(code | ||
@@ -199,0 +204,0 @@ )))) { |
Sorry, the diff of this file is not supported yet
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
27294
276