# Reusable components library (Pro)

## About the feature

Reusing is a fundamental aspect that enables developers to create advanced functionalities without investing excessive time in implementation.

In the Pro version, you can reuse *Layouts* and *Post Selections* that you've crafted for one website and use them on multiple other websites. You have the capability to preserve any item in your personal Git library, expediting the development process for future websites.

## How it works

Reusing necessitates an independent storage space (library) distinct from any specific project, along with a way of pulling and pushing items to this library.

Within Advanced Views, any GitLab repository can function as a component library, and the Advanced Views UI facilitates pulling and pushing *Layouts* and *Post Selections* into this library.&#x20;

Additionally, you have the option to include related Meta groups with the component, prompting Advanced Views to automatically create all associated Meta groups during the pull process.

We've opted for Git due to its robustness and widespread use as a version control tool, with [GitLab ](https://about.gitlab.com/)repositories being entirely free.

You can interact with the library solely through the plugin's UI or alternatively, make modifications using the git terminal and GitLab UI.

The libraries you construct are entirely yours, ensuring you maintain full control over them even after your Pro plugin license may have expired.

{% hint style="info" %}
Note: The Git library is project-independent, allowing you to continue using Git for managing specific projects, as Advanced Views refrains from creating any '.git' folder and utilizes Rest API for pulling and pushing items to the library.
{% endhint %}

## How to create a Git library

1. Create a GitLab account (free).
2. Establish a new private repository (free).
3. Navigate to the 'Git repositories' tab in the plugin settings and follow the provided instructions to add the new repository.

## How to add (push) items

Once you've added a Git repository in the settings, you can 'push' any *Layout* or *Post Selection* to the repository. Simply edit the *Layout* or *Post Selection*, select the repository from the 'GitLab repositories' box (located in the right panel), and click 'Push'.

If you select the 'Include related Meta groups' checkbox, the component will also store data of the  associated Meta Groups (such as ACF Group) and automatically import them during 'pulling'.

{% hint style="info" %}
Note: When you 'push' a *Layout* or *Post Selection*, all related *Layouts* will be included automatically. Therefore, pushing a *Post Selection* will also push the corresponding *Layout*.
{% endhint %}

## How to import (pull) items

Once you've added a Git repository in the settings, you can 'pull' any *Layout* or *Post Selection* from the repository to the current website.&#x20;

In the items list table header (*Layouts* or *Post Selections*), you'll notice a new tab named after your repository. Click on it to see the list of available items. You can then 'import' individual items or perform bulk imports.

{% hint style="warning" %}
Please be aware that importing may take some time, especially if components include Meta Groups data. Therefore, we recommend importing no more than 5 items at a time.
{% endhint %}

#### Overriding existing items

If you import items that already exist on the website, then they will be overridden instead of creating duplicate entries.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wplake.gitbook.io/advanced-views/templates/reusable-components-library-pro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
