Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
vite-plugin-style-to-vw
Advanced tools
一个可以将 标签内样式 px 转换 vw 的 plugin
npm install vite-plugin-style-to-vw -D
or
pnpm install vite-plugin-style-to-vw -D
or
yarn add vite-plugin-style-to-vw -D
vite.config.js
import vitePluginStyleToVw from "vite-plugin-style-to-vw";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
base: process.env.NODE_ENV === "production" ? "./" : "/",
plugins: [vitePluginStyleToVw({
unitToConvert: "px",
viewportWidth: 750,
unitPrecision: 5,
viewportUnit: "vw",
fontViewportUnit: "vw",
minPixelValue: 1,
}), vue()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
});
// 一行写法
<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>
// 一行写法
<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;
width:66.6667vw">
Test</h3>
// 对象写法
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;">
Test</h3>
<h3
style={{font-size:'28px';margin-top: '10px'}}>
Test</h3>
<h3
style=
{{font-size:'28px';
margin-top: '10px'}}
>
Test</h3>
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;">
Test</h3>
<h3
style="font-size: 3.73333ww;margin-top: 1.33333vw;"
>
Test</h3>
## 配置参数
**默认配置:**
```javascript
{
unitToConvert: "px", // 需要转换的单位,默认为"px"
viewportWidth: 750, // 设计稿的视口宽度,如传入函数,函数的参数为当前处理的文件路径
unitPrecision: 5, // 单位转换后保留的精度
viewportUnit: "vw", // 希望使用的视口单位
fontViewportUnit: "vw", // 字体使用的视口单位
minPixelValue: 1, // 设置最小的转换数值,如果为 1 的话,只有大于 1 的值会被转换
}
借鉴 vite-plugin-style-vw-loader https://github.com/gitboyzcf/vite-plugin-style-vw-loader
FAQs
一个可以将签内样式px转换vw的plugin
The npm package vite-plugin-style-to-vw receives a total of 1 weekly downloads. As such, vite-plugin-style-to-vw popularity was classified as not popular.
We found that vite-plugin-style-to-vw demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.