
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
@kokojs/plugin-rem
Advanced tools
@kokojs/plugin-rem 提供 rem 适配的能力。
yarn add @kokojs/plugin-rem --dev
安装完成后,在 koko.config.js 中添加如下配置:
module.exports = {
plugins: {
rem: {},
},
};
@kokojs/plugin-rem 主要做了两件事:
在编译过程中通过 postcss 的 postcss-pxtorem 插件,将代码中的 px 单位自动转换为 rem 单位。
// input
.image {
width: 100px;
height: 75px;
}
// output
.image {
width: 2rem;
height: 1.5rem;
}
@kokojs/plugin-rem 会插入一小段运行时代码,代码执行时,会根据屏幕宽度计算 rem 基准值并设置到根节点上。
<html style="font-size: 50px;">
<!-- content -->
</html>
object{ rootValue: 50, propList: ['*'] }postcss-pxtorem 插件的配置选项,详见 postcss-pxtorem 文档。
陈嘉涵。
FAQs
`@kokojs/plugin-rem` 提供 rem 适配的能力。
We found that @kokojs/plugin-rem demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies