根据API值选择主题

Theme Choosing on the basis of a certain API value

我正在做一个前端项目。我的任务是接收一个 API 令牌,然后有条件地为不同的 API 值选择一个主题(CSS 文件)。 现在我有一些计划,

1. doing something with package.json
2. using sass/compass
3. using webpack

根据项目所有者的说法,我不允许使用 less 或 sass。有什么办法吗?我正在使用 Nuxt.js .

N.B: 在项目的入口点必须做什么,即在加载整个项目之前

我完成了这个简单的任务并且工作起来很有魅力:

data(){
     return{
       api_value:0
     }
   },
   beforeCreate(){
     axios.get('my-api-link)
         .then(response=>{
          this.api_value = response.data.api_value
      })

   },

     computed:{
         inject_theme(){
           if(this.api_value ==1)
             return '/theme/dark.css'
           else if (this.api_value ==2)
              return '/theme/dark.1.css'
           else if (this.api_value ==3)
              return '/theme/dark.2.css'
         }
       },

   head () {
    return {
      title: this.title,
      meta: [
        { hid: 'description', name: this.inject_theme, content: 'My custom description' }
      ],
      link:[
        {rel:'stylesheet',href:this.inject_theme}
      ] 
    }
  }