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.

use content theme on existing nuxt project

See original GitHub issue

https://github.com/nuxt/content/edit/dev/docs/content/en/themes-docs.md

this example is outdated and wont work.

import theme from '@nuxt/content-theme-docs'

export default theme({
  env: {
    GITHUB_TOKEN: process.env.GITHUB_TOKEN
  },
  loading: { color: '#48bb78' },
  generate: {
    fallback: '404.html', // for Netlify
    routes: ['/'] // give the first url to start crawling
  },
  i18n: {
    locales: () => [{
      code: 'fr',
      iso: 'fr-FR',
      file: 'fr-FR.js',
      name: 'Français'
    }, {
      code: 'en',
      iso: 'en-US',
      file: 'en-US.js',
      name: 'English'
    }],
    defaultLocale: 'en'
  },
  buildModules: [
    ['@nuxtjs/google-analytics', {
      id: 'UA-12301-2'
    }]
  ]
})

with…

real world example config

import colors from 'vuetify/es5/util/colors'

export default {
  /*
  ** Nuxt rendering mode
  ** See https://nuxtjs.org/api/configuration-mode
  */
  mode: 'universal',
  /*
  ** Nuxt target
  ** See https://nuxtjs.org/api/configuration-target
  */
  target: 'static',
  router: {
    // for deploying on github pages
    base: '/bridged.io/'
  },

  /*
  ** Headers of the page
  ** See https://nuxtjs.org/api/configuration-head
  */
  head: {
    titleTemplate: '%s - ' + process.env.npm_package_name,
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Global CSS
  */
  css: [],
  /*
  ** Plugins to load before mounting the App
  ** https://nuxtjs.org/guide/plugins
  */
  plugins: [],
  /*
  ** Auto import components
  ** See https://nuxtjs.org/api/configuration-components
  */
  components: true,
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    '@nuxt/typescript-build',
    '@nuxtjs/vuetify',
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/pwa',
    // Doc: https://github.com/nuxt/content
    '@nuxt/content',
  ],
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  axios: {},
  /*
  ** Content module configuration
  ** See https://content.nuxtjs.org/configuration
  */
  content: {},
  /*
  ** vuetify module configuration
  ** https://github.com/nuxt-community/vuetify-module
  */
  vuetify: {
    customVariables: ['~/assets/variables.scss'],
    theme: {
      dark: false,
      themes: {
        light: {
          primary: "#ED6570",
          accent: colors.grey,
          secondary: colors.amber,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3
        },
        dark: {
          primary: colors.blue.darken2,
          accent: colors.grey.darken3,
          secondary: colors.amber.darken3,
          info: colors.teal.lighten1,
          warning: colors.amber.base,
          error: colors.deepOrange.accent4,
          success: colors.green.accent3
        }
      }
    }
  },
  /*
  ** Build configuration
  ** See https://nuxtjs.org/api/configuration-build/
  */
  build: {
  }
}

when i wrap that config with theme(config), below error will show

 FATAL  server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration

  at WebSocketServer.completeUpgrade (node_modules/ws/lib/websocket-server.js:267:13)
  at WebSocketServer.handleUpgrade (node_modules/ws/lib/websocket-server.js:245:10)
  at WS.handleUpgrade (node_modules/@nuxt/content/lib/ws.js:21:21)
  at WS.hook (node_modules/@nuxt/content/lib/ws.js:11:14)
  at fn (node_modules/hookable/dist/hookable.js:118:45)
  at promise.then (node_modules/hookable/dist/hookable.js:18:61)
  at process._tickCallback (internal/process/next_tick.js:68:7)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

20reactions
kissucommented, Oct 27, 2020

Agreed that a docs theme inside of an existing nuxt project would be amazing ! ⭐

1reaction
softmarshmallowcommented, Aug 19, 2020

tried it, cannot find a way to integrate it with existing project. if it needs to be done by actually adding tailwind css tags, than it will be no use. some magic plugin that enables only applies to generated content might be great. any ways or plan on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a Blog with Nuxt Content
Different theme can be used, for example prism-themes , we can install it and then add our preferred theme to the content options...
Read more >
Power your blog with Nuxt Content
We can create a new Nuxt content project or add it to an existing Nuxt 3 project. You can start a new Nuxt...
Read more >
Build a multi-theme website using Nuxt.js, TailwindCSS and ...
In this tutorial, you will learn how to create a multiple theme website with Nuxt.js 2, TailwindCSS, and DaisyUI. You will learn how...
Read more >
Create a Nuxt.js blog with the content module - Koen Woortman
Use the Nuxt.js content module to run a blog with Markdown content, turning your Nuxt project into a git-based headless CMS.
Read more >
Nuxt.JS Theming #1 - Adrian Jost
The trick we will do now is, to generate aliases for all components in the theme directory and push them into our alias...
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