1.0.0-alpha.2 • Published 6 months ago

vue-route-loader v1.0.0-alpha.2

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Vue Route Loader

npm version vue-route-loader version Vue version

package quality npm downloads npm monthly downloads npm weekly downloads

build status license

vue-route-loader is a dynamic route generation module for Vue.js applications, which automatically creates Vue router routes based on the Vue components' file structure.

Features

  • Dynamic Route Generation: Scans a specified directory for Vue components and generates routes automatically.
  • Nested Route Support: Handles nested routes and special cases like index and parameterized paths.
  • Error Handling: Includes error handling for directory reading and a fallback route for 404 errors.
  • Easy Integration: Seamlessly integrates generated routes with the Vue application setup.

Installation

Install vue-route-loader via npm:

npm install vue-route-loader

Usage

  1. Import the Module: Import vue-route-loader in your project where you need to generate routes.

  2. Configure Source Directory: Specify the directory of your Vue components to generate routes. For example:

const sourceDirectory = path.join(__dirname, '../src/pages');
  1. Generate Routes: Use vue-route-loader to generate routes, which will create a generatedRoutes.ts file in your specified output path.

  2. Integrate with Vue Application: Integrate the generated routes with your Vue application's router setup.

Customization

  • Route Patterns: Adjust the route generation logic in the generateRoutes function to match your directory structure and routing preferences.
  • Error Handling: Customize the error handling within the script for various read errors.

Contributing

Contributions to improve vue-route-loader are welcome. Please follow the standard Git workflow:

  1. Fork the repository.
  2. Create a feature branch.
  3. Commit your changes.
  4. Push to the branch and open a pull request.

License

This project is licensed under the MIT License.

Author

Just replace [Your Contact Information] with your actual contact details. This README.md is structured to provide a clear overview of the project, including installation, usage, customization, contributing guidelines, license, and author information.

Copyright (c) SimonMarcelLinden.