New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-style-to-vw

Package Overview
Dependencies
Maintainers
0
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-style-to-vw - npm Package Compare versions

Comparing version 1.8.5 to 1.8.6

2

package.json
{
"name": "vite-plugin-style-to-vw",
"version": "1.8.5",
"version": "1.8.6",
"description": "一个可以将签内样式px转换vw的plugin",

@@ -5,0 +5,0 @@ "exports": {

@@ -9,25 +9,2 @@ # vite-plugin-style-to-vw

## Development reasons
Some plug-ins will convert class='text-20px' in the atomic plug-in class to class='text-2.666666666665vw', so I wrote this plug-in, only convert class =' text-20px 'in style
Since some plug-ins do not need to be atomized and want px in all attributes to be converted to vw, you can set the allReplace configuration option to true
## The default processing style can also be added. Only vue,(react is not supported, please use it with stylePxToVw)
```javascript
vitePluginStyleToVw({
allReplace:false,
attributeList:['size','height','width'] // Additional properties that can be handled
})
```
## all processing
```javascript
vitePluginStyleToVw({
allReplace:true,
})
```
## Description

@@ -60,5 +37,3 @@ - Support vue,tsx,jsx file input

vite.config.js
### Vue, must be written before vue ()
### vue example,react is the same
```javascript

@@ -84,22 +59,24 @@ import { defineConfig } from "vite";

### react
## Development reasons
Some plug-ins will convert class='text-20px' in the atomic plug-in class to class='text-2.666666666665vw', so I wrote this plug-in, only convert class =' text-20px 'in style
Since some plug-ins do not need to be atomized and want px in all attributes to be converted to vw, you can set the allReplace configuration option to true
## The default processing style can also be added. Only vue,(react is not supported, please use it with stylePxToVw)
```javascript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import vitePluginStyleToVw from 'vite-plugin-style-to-vw';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vitePluginStyleToVw(),
react()
],
vitePluginStyleToVw({
allReplace:false,
attributeList:['size','height','width'] // Additional properties that can be handled
})
```
## all processing
```javascript
vitePluginStyleToVw({
allReplace:true,
})
```
## Support for vue,tsx,jsx file import
### Input

@@ -106,0 +83,0 @@ ```html

@@ -10,27 +10,2 @@

## 开发原因
有些插件会将class中原子化插件的中的class='text-20px' 转换为 class='text-2.6666666666666665vw',所以写了这个插件,
只转化style中的,
鉴于有些不用原子化插件,又希望全部属性中的px都转换成vw,allReplace 配置选项设置为true即可
## 默认处理 style ,也可以添加额外的属性处理,只支持vue,(react不支持,react请搭配stylePxToVw使用)
```javascript
vitePluginStyleToVw({
allReplace:false,
attributeList:['size','height','width'] // Additional properties that can be handled
})
```
## 全部处理
```javascript
vitePluginStyleToVw({
allReplace:true,
})
```
## 说明

@@ -62,2 +37,3 @@

## 使用

@@ -67,3 +43,3 @@

### vue, 必须写在vue()前面
### vue示例 ,react同理
```javascript

@@ -89,18 +65,25 @@ import { defineConfig } from "vite";

### react
## 开发原因
有些插件会将class中原子化插件的中的class='text-20px' 转换为 class='text-2.6666666666666665vw',所以写了这个插件,
只转化style中的,
鉴于有些不用原子化插件,又希望全部属性中的px都转换成vw,allReplace 配置选项设置为true即可
## 默认处理 style ,也可以添加额外的属性处理,只支持vue,(react不支持,react请搭配stylePxToVw使用)
```javascript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import vitePluginStyleToVw from 'vite-plugin-style-to-vw';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vitePluginStyleToVw(),
react()
],
vitePluginStyleToVw({
allReplace:false,
attributeList:['size','height','width'] // Additional properties that can be handled
})
```
## 全部处理
```javascript
vitePluginStyleToVw({
allReplace:true,
})
```

@@ -107,0 +90,0 @@

@@ -134,6 +134,6 @@ import type { IdefaultsProp } from './index.d'

createPxReplace(
customOptions.viewportWidth,
customOptions.minPixelValue,
customOptions.unitPrecision,
customOptions.viewportUnit,
customOptions.viewportWidth as number,
customOptions.minPixelValue as number,
customOptions.unitPrecision as number,
customOptions.viewportUnit as string,
),

@@ -173,6 +173,6 @@ )

createPxReplace(
customOptions.viewportWidth,
customOptions.minPixelValue,
customOptions.unitPrecision,
customOptions.viewportUnit,
customOptions.viewportWidth as number,
customOptions.minPixelValue as number,
customOptions.unitPrecision as number,
customOptions.viewportUnit as string,
),

@@ -210,6 +210,6 @@ )

createPxReplace(
customOptions.viewportWidth,
customOptions.minPixelValue,
customOptions.unitPrecision,
customOptions.viewportUnit,
customOptions.viewportWidth as number,
customOptions.minPixelValue as number,
customOptions.unitPrecision as number,
customOptions.viewportUnit as string,
),

@@ -242,5 +242,8 @@ )

// @ts-ignore
if (typeof window !== "undefined") {
try {
// 读取文件,node端生成合并的配置,
// ts忽略下文
// @ts-ignore
const json = await import('/node_modules/vite-plugin-style-to-vw/dist/file.json')

@@ -263,5 +266,5 @@ extraOptions = json.default

createPxReplace(
customOptions.viewportWidth,
customOptions.minPixelValue,
customOptions.unitPrecision,
customOptions.viewportWidth as number,
customOptions.minPixelValue as number,
customOptions.unitPrecision as number,
''

@@ -282,6 +285,6 @@ ),

createPxReplace(
customOptions.viewportWidth,
customOptions.minPixelValue,
customOptions.unitPrecision,
customOptions.viewportUnit,
customOptions.viewportWidth as number,
customOptions.minPixelValue as number,
customOptions.unitPrecision as number,
customOptions.viewportUnit as string,
),

@@ -288,0 +291,0 @@ )

@@ -16,3 +16,3 @@ {

"noImplicitAny": false,
"types": ["./src/index.d.ts","dist"]
"types": ["./src/index.d.ts"]
},

@@ -19,0 +19,0 @@ "include": ["src/*", "*.d.ts"],

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc