Import Stylus Variable Another File Vue Vite

182 Views Asked by At

For the following stylus variables file that is loaded globally using the preprocessorOptions in my vite.config file:

// variables.styl:

boxShadow = 0px 0px 15px 0px rgba(0,0,0,.07)

:export
  boxShadow boxShadow

How can I access it in another file such as:

// otherFile.js

import variables from '@/styles/variables.styl'

export function sample () {
  console.log(variables) // returns :export { boxShadow: 0px 0px 15px 0px rgba(0,0,0,0.07);}
  console.log(variables.boxShadow) // returns undefined
}

How can I access the value of variables.boxShadow in another javascript file?

0

There are 0 best solutions below