Answer the question
In order to leave comments, you need to log in
How to load sass depending on the selected condition?
I'm doing a project on nuxt. Such a task is worth it.
There are three different html templates. Templates will change depending on what came from the server.
Each template has its own SASS file.
Is there a way to load different styles?
For example, the server returned "Template 1" I load main1.sass
Answer the question
In order to leave comments, you need to log in
const addLink = path => {
let link = document.createElement("link")
link.setAttribute("rel", "stylesheet")
link.setAttribute("href", path)
document.getElementsByTagName("head")[0].appendChild(link)
}
const templatenumber = 1
addLink('./style' + templatenumber + '.scss')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question