I got a rather simple problem with a VueJS component that needs to use a variable. The problem comes with getting sass to register variables inside a component.
I tried importing the _variables.scss
file containing my variables but to no luck. At this point any guidance is very much appreciated, or if there is another way for a component to inherit styling.
MyComponent.vue
<template>
<div class="my-color"></div>
</template>
<style lang="sass">
.my-color {
color: $primary-color;
}
</style>
<script>
export default{
data(){
return {}
}
}
</script>
Gulpfile.js
var elixir = require('laravel-elixir');
require('laravel-elixir-vueify');
elixir(function(mix) {
mix.browserify('main.js');
mix.sass('app.scss');
});
app.scss
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";
@import "modules/variables";
variables.scss
$primary-color: #BA2731; //Red
@import
also being present in the compiled CSS, several times, afterwards. This triggers the browser to load the file, which doesn't exist. How do we stop this? @Bozeman – Sinistrous