Giter Club home page Giter Club logo

k-domains's Introduction

Welcome to k-domains 👋

Version Documentation npm License: MIT Twitter: MadhusudanBabar

k-domains

✨ Demo

portfolio & blog

What is this ?? 🤔

A simple nuxt module to manage multiple subdomains with just a single nuxtJS project

What problem does this solves??

     Ever wondered how will you setup 3 sites of your own where you have same layouts & few shared components like feedback forms and so??
The simple way to do is copy, paste the same in all those 3 projects... isn't it??
But when you have to make changes, so you will require to copy the same thing in all the other projects...
This is not the right way... ❌❌❌
     k-domains let's you manage any number of subdomains with ease and that too without even need to create separate project for each subdomain (site). All your layouts, shared components and the code for these sites will live in one project only.
     All you have to is to just add k-domains and configure it in your nuxt.config.js file as shown in the #setup.

Install

yarn add k-domains # or npm i k-domains

Setup

  1. Add k-domains to your project
yarn add k-domains # or npm i k-domains
  1. Add @nuxtjs/router to your project
yarn add @nuxtjs/router
  1. Configure k-domains and @nuxtjs/router to the buildModules section of nuxt.config.js as follows:
  export default {
    buildModules: [
      [ "k-domains", {
          subDomains: [ ], // List of directories to hold te pages for your subdomains
          rootDomain: "root-domain" //  directory to hold the pages for root domain  
      }
      ],
      ["@nuxtjs/router",{
          keepDefaultRouter: true // this line is mandatory...
      }
      ]
    ]
}
  1. Example
  export default {
    buildModules: [
      [ "k-domains", {
          subDomains: ["blog", "projects", "anotherSubDomain" ], // List of directories to hold te pages for your subdomains
          rootDomain: "main-domain" //  directory to hold the pages for root domain  
      }
      ],
      ["@nuxtjs/router",{
          keepDefaultRouter: true // this line is mandatory...
      }
      ]
    ]
}

and the tree for the pages should look like this:

|   
|─pages
|   ├───blog
|   ├───projects
|   ├───main-domain
|   └───anotherSubDomain
  1. That's it, now create pages in respective directories and it'll be mapped to that subdomains.

Options

subDomains

  • Type: Array<String> Add your subdomains here

rootDomain

  • Type: String directory name for the pages of root-domain

Author

👤 krypton < [email protected] >

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Consider giving a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.