[Vuejs]-How to use my variables.scss in component <style>in vite vue 3

1πŸ‘

βœ…

maybe

1、

// component
<style lang="scss">
 @import "../../../assets/variable.scss";
</style

2、

// main.ts
import './assets/variable.scss'

3、

// vite.config.ts
preprocessorOptions: {
   scss: {
     additionalData: '@use "@/assets/variable.scss"as *;'
   }
}

Use any one of them

Leave a comment