> For the complete documentation index, see [llms.txt](https://xoops.gitbook.io/assetics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xoops.gitbook.io/assetics/base-assets.md).

# Base Assets

* XOOPS Core uses the base assets for common system wide assets, such as jQuery, jQueryUI, locale and Bootstrap assets
* Themes can add to the base assets using **theme\_onload.php**
* Modules may want to add their common assets to the base asset
* Browser cache use is improved if the same base asset definition is used for many pages

**setNamedAsset**

Accepts a unique asset name Accepts an array of one or more asset file specifications Optionally accepts a string of comma separated filter names Results in creating an asset **reference** that can be specified in asset arrays in place of a file specification

## Name Assets

Named assets allow symbolic reference to commonly used assets (i.e. “jquery”) Named assets can be given additional filters

Using setNamedAsset does not create the asset, it just records the name and definition

To use an asset named “jquery” include an asset name of “@jquery” in an asset list

## Smarty Assets Tag

The Smarty block plugin allows assets to be defined in templates. Full syntax:

![2015-05-25\_103806.jpg](/files/-LD6N3gUzhD4uKaPDayF)

**Assets Tag Argument:**

| Tag        | Meaning                                                                             |
| ---------- | ----------------------------------------------------------------------------------- |
| assets     | comma separated list of assets to process.                                          |
| output     | type of output, “css” or “js”                                                       |
| debug      | true to enable debug mode, default is false                                         |
| filters    | list of  filters to apply, if not specifed will use default filters for output type |
| asset\_url | smarty variable to assign asset path, defaults to “asset\_url”                      |

## Behind the Scenes

* Xoops\Core\Assets.php handles communication with the Assetic library
* Xoops object establishes a single instance of Assets class, and XoopsTheme references it
* Configuration of Assets class is in  ***xoops\_path/configs/system\_assets\_prefs.yml***, but it normally should not need to be changed

**copyFileAssets()**

To handle fonts and images in some special circumstances, a file copy function is provided.

```
Xoops\Core\Assets::copyFileAssets()
```

This method copies files to the asset directory. Copying is normally only needed for fonts or images when they are referenced by a relative URL in a stylesheet, or are located outside of the web root, as might be the case of a file asset located in a vendor package.

## Turning on Debug

* Easiest way is to include ASSET\_DEBUG=1 in the URL, i.e. index.php?ASSET\_DEBUG=1
* Add this call to your code:&#x20;

```
\Xoops::getInstance()->assets()->setDebug(true);
```

* Add **debug=true** to a Smarty assets tag
* Any of these will turn off any filters prefixed with a question mark (by default cssmin and jsmin)

## Examples

You probably would like to see some examples of the Assets Management.

**The best source of Asset Management examples is XOOPS 2.6.0 itself.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://xoops.gitbook.io/assetics/base-assets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
