A
A
Alexander2017-10-31 19:44:24
Preprocessors
Alexander, 2017-10-31 19:44:24

Is it possible to set autoprefix for class names in vue-loader?

I have the names of all classes in the component begin with its name. For example:

<div class="component-name">
   <div class="component-name-element-name"></div>
   <div class="component-name-another-element-name"></div>
</div>

Is there any auto-prefixer to avoid writing a rather long component name each time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Belyaev, 2017-10-31
@LordGuard

<template>
<div :class="$style.component">
   <div :class="$style.element"></div>
   <div :class="$style['another-element']"></div>
</div>
</template>

<style module>
.component {}
.element {}
.another-element {}
</style>

module, unlike scoped, changes class names to a unique hash, and throws it into the vm.$style object
selectors are mega lightweight

A
Artur Bordenyuk, 2017-10-31
@HighQuality

You can use scoped css

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question