Installation

This section will walk you through the steps required to set up ReqEase in your project. You have multiple installation options to choose from, so pick the one that suits your project best.

Installation Instructions

If you're working in a module environment, you can use npm to install ReqEase as a package. This method is ideal if you want to manage ReqEase as a dependency in your project.

Install ReqEase

npm install @reqease/reqease

This will download and install ReqEase and its dependencies into your project.

Create a Custom ReqEase calling (optional)

While not mandatory, creating a custom ReqEase calling allows you to set default configurations for ReqEase throughout your entire website. For instance, you can specify global options like the validation source, default constraints, and more.

import ReqEase from '@reqease/reqease';

const defaultOptions = {
  ...
};

class MyCustomReqEase {
  reqEaseInstance;
  constructor(exceptionalOptions) {
    let options = $.extend(true, defaultOptions, exceptionalOptions);
    this.reqEaseInstance = new ReqEase(options);
  }
  
  getReqEaseInstance() {
    return this.reqEaseInstance;
  }
}

// Now, you can use MyCustomReqEase throughout your website instead of ReqEase.

Usage:

const myCustomReqEase = new MyCustomReqEase();

By creating a custom class, you avoid repeating the same configuration for ReqEase in every script. This approach simplifies management and maintenance, especially in larger projects.

Using static script tags

If you prefer not to use npm and want a quick way to include ReqEase in your project, you can use a static script tag. ReqEase can be loaded via CDN or by downloading the script and including it in your project.

  • CDN

To include ReqEase via CDN, add the following script tag to your HTML file's <head> section:

<script src="https://cdn.jsdelivr.net/gh/ReqEase/ReqEase@latest/dist/reqease.min.js"></script>
  • Local Download

If you prefer a local copy of ReqEase, download the script from the ReqEase repository and include it in your project:

  1. Download the reqease.js ( or reqease.min.js )file.

  2. Place the downloaded file in your project directory.

  3. Include the script in your HTML file:

<script src="path/to/reqease.js"></script>

Additionally, I'll mention that certain configurations, like registering custom classes, are available exclusively in the module environment. To learn more about these advanced options, refer to the advanced configurations section in this documentation.

This flexible installation approach allows you to choose the best setup based on your project's needs, whether you're looking for extensive customization or a straightforward integration.

Last updated