Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuxt.js: Managing several websites/domains in 1 project

Tags:

vue.js

nuxt.js

let's say we have website A, website B, website C. They will all be on their own domain (mypage-a.com, mypage-b.com, mypage-c.com). The framework used is nuxt.js.

However, all 3 websites should have access to the same /components dir. Therefore, it would make sense to be able to have the same project for all 3 websites.

How could we set this up best? It seems like we have to temper a lot with the default settings. Important things to mention:

  • our websites are all 100% static (no SPA, no SSR)
  • we only use <a> tags, no <nuxt-link>
  • the same /components dir should be available to all 3 subprojects
like image 361
Beppe Avatar asked Dec 31 '22 16:12

Beppe


1 Answers

We solved it like this:

  • 1 repository for all projects together

  • In a directory projects, we defined all the subprojects we need, all with their own nuxt.config.js

  • Shared components are in the root directory

  • Other shared code (nuxt.config.base.js, css etc) goes into the root directory, end gets extended by the subprojects if needed

|-components
|-projects
  |-A
    |-components
    |-pages
    |-nuxt.config.js
    |-...
  |-B
    |-...
|-nuxt.config.base.js
like image 107
Beppe Avatar answered Jan 12 '23 15:01

Beppe