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
1
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.0.0 to 1.0.1

2

dist/index.js

@@ -55,3 +55,3 @@ "use strict";

var templateReg = /<template>([\s\S]+)<\/template>/gi;
var pxGlobalReg = /(\d+)px/gi;
var pxGlobalReg = /(\d+)px/;
var styleRegex = /style\s*=\s*(?:"([^"]*?)"|'([^']*?)'|{([^}]*)})/g;

@@ -58,0 +58,0 @@ function vitePluginStyleToVW(customOptions = defaultsProp) {

{
"name": "vite-plugin-style-to-vw",
"version": "1.0.0",
"description": "一个可以将vue3标签内样式px转换vw的plugin",
"version": "1.0.1",
"description": "一个可以将签内样式px转换vw的plugin",
"exports": {

@@ -6,0 +6,0 @@ ".": {

# vite-plugin-style-to-vw
一个可以将 Vue3 标签内样式 px 转换 vw 的 plugin
一个可以将 标签内样式 px 转换 vw 的 plugin

@@ -50,29 +50,72 @@

### 可以输入
### vue 文件
```
// 一行写法
<h3 style="font-size: 28px;margin-top: 10px;width:500px">Test</h3>
// 换行写法
<h3 style="
font-size: 28px;
margin-top: 10px;
width:500px;">
Test</h3>
// 对象写法
<h3
:style="{fontSize:'28px',marginTop: '10px'}">
Test</h3>
```
### 输出
```html
<h3 style="font-size: 28px;margin-top: 10px" width="500px">Test</h3>
// 一行写法
<h3 style="font-size: 3.73333ww;margin-top: 1.33333vw;width:66.6667vw">Test</h3>
<h3 style="
font-size: 28px;
margin-top: 10px";
width:500px">Test</h3>
// 换行写法
<h3 style="
font-size: 3.73333ww;
margin-top: 1.33333vw;
width:66.6667vw">
Test</h3>
// 对象写法
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;">
Test</h3>
```
# 也支持tsx,jsx 文件
### 输入
```
<h3
:style="{font-size:'28px';margin-top: '10px'}">
Test</h3>
style={{font-size:'28px';margin-top: '10px'}}>
Test</h3>
<h3
style={{font-size:'28px';margin-top: '10px'}}>
Test</h3>
style=
{{font-size:'28px';
margin-top: '10px'}}
>
Test</h3>
```
### 输出
```
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;">
Test</h3>
```html
<h3 width="66.66667vw" style="font-size: 3.73333vw; margin-top: 1.33333vw;">
Test
</h3>
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;"
>
Test</h3>
```
### 如果你不想转换 请用PX代替
```
## 配置参数

@@ -79,0 +122,0 @@

@@ -43,3 +43,3 @@ interface IdefaultsProp {

const templateReg = /<template>([\s\S]+)<\/template>/gi;
const pxGlobalReg = /(\d+)px/gi;
const pxGlobalReg = /(\d+)px/g;
const styleRegex = /style\s*=\s*(?:"([^"]*?)"|'([^']*?)'|{([^}]*)})/g;

@@ -46,0 +46,0 @@

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