The only way I've been able to achieve this is to add an import statement to the top of your component <style> section, to import your 'variables' file. You'd have to do that for each component that needs to use a variable.
Jun 14, 2016
2
Level 6
How to pass SCSS variables into vueify component
Let's say I have a main SCSS variables file (called _variables.scss). In it, I've defined my color scheme and other stuff that will be re-used throughout the site.
Next, I use vueify (or laravel-elixir-vueify) to create Vue components. I want to include SCSS styling in each component, however whenever I try to reference a variable from _variables.scss, it throws an error saying that the variable is undefined.
<template>
<!-- HTML stuff here -->
</template>
<script>
// the components JS here...
</script>
<style lang="scss">
#main-banner {
color: $brand-primary;
}
//throws "Variable $brand-primary not defined"
</style>
How could I pass variables from _variables.scss to my vue component?
Level 20
Please or to participate in this conversation.