0.0.2 • Published 3 years ago
vite-plugin-transform-inline-style v0.0.2
Vite Plugin Transform Inline Style
将class转换为style的vite插件,WIP
用法
import vitePluginTransformInlineStyle from 'vite-plugin-transform-inline-style'
// vite.config.ts
export default defineConfig({
plugins: [
vitePluginTransformInlineStyle()
]
})
说明
- 仅支持vue文件
- 目前仅支持单层的class转换,如
.a {}
, 不支持.a .b {}
运行前
<template>
<div class="red" style="background: yellow" />
</template>
<style scoped>
.red {
color: red;
font-size: 14px;
}
.red .a {
color: yellow;
}
</style>
运行后
<template>
<div class="red" style="background: yellow;color: red;
font-size: 14px;" />
</template>
<style scoped>
.red .a {
color: yellow;
}
</style>