Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stylis-plugin-px2vw

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylis-plugin-px2vw

一个将 px 换算成 vw 的 stylis 插件

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-94.74%
Maintainers
1
Weekly downloads
 
Created
Source

使用

一个 stylis 插件,用于将 px 换算为 vw 单位,可用于 css-in-js 库 @emotion/css

其他使用了 stylis 的库,如支持插件也可以使用

demo 见 src/example.ts

import createEmotion from '@emotion/css/create-instance'
import stylisPluginPx2vw from 'stylis-plugin-px2vw'

const customEmotion = createEmotion({
  key: 'm',
  stylisPlugins: [stylisPluginPx2vw({
    excludes: ['font-size'] // 不需要转换的属性
    minWidth: 320, // 最小宽度 默认
    width: 375, // 设计稿宽度 默认
    precision: 4, // 转换 vw 单位精度 默认
  })],
})

只匹配小写的 px, 如果有特别的属性值不希望转换,可以写成大写 PX,如:width: 100PX;

Keywords

FAQs

Package last updated on 17 May 2021

Did you know?

Socket

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.

Install

Related posts

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