vite-plugin-vue3-bem
v1.0.12
Published
Making vue3-bem run in vite.
Downloads
12
Maintainers
Readme
vue3-bem vite plugin
Making vue3-bem run in vite.
Feature
- remove import vue3-bem
Use
It is only written with 'script setup', set attr bem-block
as block.
use it as follow.
setting in vite.config.js.
// vite.config.js
import ViteVue3Bem from "vite-plugin-vue3-bem";
plugins:[
ViteVue3Bem()
]
in SFC
// like it
<template>
<div class="tip">
<div :class="bem('wrap')"></div>
</div>
</template>
<script lang="ts" bem-block="tip">
</script>
// equivalent to
<template>
<div class="tip">
<div :class="bem('wrap')"></div>
</div>
</template>
<script lang="ts" bem-block="tip">
import useBem from "./useBem";
const bem = useBem('tip');
</script>