Skip to content

feature->develop | vaahcms-url-to-publish-assets #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions content/2.vaahcms-2x/3.getting-started/7.publish-assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Publish Assets
---


## Overview
Publishing assets in VaahCMS refers to making specific resources or files
(e.g., JavaScript, CSS, images, or other static files) publicly accessible or usable within the application.

This is especially helpful when you want to prepare assets for a **module** or **theme**, but its assets are not yet available in your system.



## Ways to Publish Assets

### From Backend (System-Level Publishing)

VaahCMS provides a backend functionality that lets administrators manage and publish assets for
modules or themes. This method is ideal for users who have direct access to the VaahCMS backend.

For more information, see the [From VaahCMS Module ](../../../vaahcms-2x/the-basics/extend/modules#vaahcms-module){:target="_blank"} section.

### Through the API (Remote Publishing via URL)
This API endpoint is designed for situations where you need to programmatically publish assets without accessing the VaahCMS backend.
It is particularly useful for developers automating deployment processes or working on remote systems.


#### API
```php
POST <public-url>/api/publish/assets/{slug}
```

#### Response
```json
{
"success": true,
"messages": [
"Assets published."
]
}
```

#### Error Response
```json
{
"success": false,
"errors": [
"Module/Theme not found."
]
}
```

#### Use Case Scenarios
**Module Assets:**
For a module like Travels, use its slug (travels) to publish its assets either via the backend or the API.

**Theme Assets:**
For a theme like Modern Theme, use the theme slug (modern-theme) to prepare its CSS and JS files for the application.

## Description
This API allows you to publish the assets of a specific **module** or **theme**, identified by its {slug}.
you can use this endpoint to make its assets available for use.
3 changes: 3 additions & 0 deletions content/2.vaahcms-2x/4.the-basics/5.extend/1.modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ By clicking on `Deactivate` button will Deactivate the module.

It will put the required css and js files from resources to public folder so that all the properties can be use easily.

For more details, see the ways [How to Publish Assets](../../../vaahcms-2x/getting-started/publish-assets){:target="_blank"} guide.


<img src="/images/publish-assets.png">

### Import data
Expand Down