You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the above example, if your project uses `scss`, then you need to configure `preprocessor: { sass }`,
186
-
It is worth noting that you also need to configure `includeCompile: ['**/**.css', '**/**.scss']`,
187
-
Because it is entirely up to you to read which files (.sass or .less, or .styl) to use `unplugin-vue-cssvars`.
188
-
189
-
### Details about revoke
190
-
> 💡 v1.0.0 version to solve the problem of duplicate code, no longer need to set
191
-
192
-
Suppose there are two files `App.vue` and `test.css`
193
-
````
194
-
<script setup lang="ts">
195
-
const color = 'red'
196
-
</script>
197
-
198
-
<template>
199
-
<div class="test">
200
-
TEST
201
-
</div>
202
-
</template>
203
-
204
-
<style scoped>
205
-
@import "./assets/test";
206
-
</style>
207
-
208
-
````
209
-
````
210
-
/** test.css **/
211
-
div {
212
-
color: v-bind(color);
213
-
}
214
-
````
215
-
After building with `vite` when `unplugin-vue-cssvars` is not used
216
-
````
217
-
/** test.css **/
218
-
div[data-v-2e7c9788] {
219
-
color: var(--8bcabd20);
220
-
}
221
-
````
222
-
Among them, the hash of `color: var(--8bcabd20);` will not appear in the component packaging product, because `vue` does not support the use of `v-bind` in the file.
223
-
When built with `vite` using `unplugin-vue-cssvars` (`minify: false`)
224
-
````
225
-
/** test.css **/
226
-
div[data-v-1dfefb04] {
227
-
color: var(--516b0d4a);
228
-
}
229
-
230
-
/* created by @unplugin-vue-cssvars */
231
-
/* <inject start> */
232
-
div[data-v-1dfefb04]{color:var(--516b0d4a)}
233
-
/* <inject end> */
234
-
````
235
-
It can be seen that the code will be injected through `unplugin-vue-cssvars`, and it depends on `@vue/compiler-dom`, whose hash value can appear in the component packaging product.
236
-
But observation found that this code is repetitive.
237
-
Therefore, turning on the `revoke` option will remove duplicate code
0 commit comments