I'm building an App with Vue.js and CSS Components. There are some Vue components, which share common styling.
Hello.vue:
<template>
<div :class="$style.title">Hello, World</div>
</template>
<script>
export default {}
</script>
<style module src="./common.css"></style>
GoodBye.vue:
<template>
<div :class="$style.title">Goodbye, cruel world.</div>
</template>
<script>
export default {}
</script>
<style module src="./common.css"></style>
common.css:
.title {
font-weight: bold;
}
When I compile and run this code, there are a duplicated CSS class(._2miFMUAEBLdLB9wHpgrYF2
):
Screenshot: Duplicated CSS classes
How can I fix this duplication?
Complete code is available here: https://github.com/ryo-utsunomiya/css-modules-common-style
this.$commonStyles
). – ryo