I am trying to import a scss file within my VueJS project, where it will then compile and thus be able to use with my project. However, I need some help, as at present it simply errors. Is there a way to do this? Please note, I am very new to VueJS so I'm just getting my head around the basics.
I created a folder called scss within my src folder, which contains my main.scss file. Next in my Vue.JS I have the following code;
<template>
<div id="app">
<Home></Home>
<Primary></Primary>
<Secondary></Secondary>
</div>
</template>
<script>
import Home from './components/Home.vue'
import Primary from './components/Primary.vue'
import Secondary from './components/Secondary.vue'
export default {
name: 'app',
components: {
'Home': Home,
'Primary': Primary,
'Secondary': Secondary
}
}
module.exports = {
css: {
loaderOptions: {
sass: {
data: `
@import "@/scss/main.scss";
`
}
}
}
};
</script>
<style lang="scss">
#app {
display:block;
}
</style>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…