question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Config alias `theme` to `extends`

See original GitHub issue

It is more semantic to have single theme for when extending a theme layer. In addition, we can have an object shortcut syntax to provide layer options. (Depends on #24))

From:

export default defineNuxtConfig({ 
  extends: 'docus',
  // https://github.com/unjs/c12/issues/9
  extends: { from: 'docus', override: { featureFlag: true } }
}

To:

export default defineNuxtConfig({ 
  theme: 'docus',
  theme: [docus, { featureFlag: true }]
}

Q: What about theme configuration? It goes under app namespace as a runtime config: (or better app/theme.config file https://github.com/nuxt/framework/issues/5918)

export default defineNuxtConfig({ 
  app: {
    theme: { }
  }
}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pi0commented, Sep 1, 2022

Thanks for your feedback and ideas @sawden. Extends (and Theme alias) are built-time features coming with their cons and pros (Pro: not everything is possible to be changed on runtime and tree-shaked build time gives it. Con: Cannot change theme variants at runtime)

I think this definitely worth to discuss more about runtime themeing (Now we have app.config could enable this too!)

1reaction
sawdencommented, Jul 26, 2022

I took a closer look at the extends feature over the past few days and found that it is currently not possible to switch between the different versions during the runtime, as only a final version of the app is being built.

This means for the scenario described here, that a separate version of the app has to be deployed for each “theme”.

Could we implement switching between themes at runtime? My suggestion would be to add a theme switch to the <NuxtPage /> component.

defineNuxtConfig({
   extends: [
      './base',
      {
            path: './themeB',
            name: 'theme-b'
       },
      {
            path: './themeC',
            name: 'theme-c'
       }
   ]
})
<template>
    <NuxtPage extendsName="theme-b" />
</template>

This would take themes to the nuxt level 😉. I open to any feedback and would try to implement the feature if desired.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Circular definition of import alias 'theme' - Stack Overflow
I am trying to extend the theme of a third party private npm module. The project compiles successfully but I keep getting a...
Read more >
Module Resolution or Import Alias: The Final Guide - Raul Melo
Tired to have weird imports? It's time to learn how can you enable aliases to your imports and let code more organized.
Read more >
Extending - VuePress 2
Default theme has registered alias for every non-global components open in new window with a @theme prefix. For example, the alias of HomeFooter ......
Read more >
Customizing Colors - Tailwind CSS
Aliasing color names. You can also alias the colors in our default palette to make the names simpler and easier to remember: tailwind.config....
Read more >
Extend a theme - Product Documentation | ServiceNow
After extending a theme, you can then override inherited styles from the main theme by setting more specific styles in the extended theme...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found