---
title: "Asset ViewHelper <vite:asset>"
manual: "Vite AssetCollector"
version: "main"
permalink: "https://docs.typo3.org/permalink/praetorius/vite-asset-collector:viewhelper-asset@main"
source: "Reference/ViewHelpers/Asset.rst"
rendered: "2026-09-27T16:10:16+00:00"
---

# Asset ViewHelper `<vite:asset>` {#viewhelper-asset}

The `vite:asset` ViewHelper embeds all JavaScript and CSS belonging to the
specified vite `entry` using TYPO3's AssetCollector API.

## Example {#example}

```html
<html
    data-namespace-typo3-fluid="true"
    xmlns:vite="http://typo3.org/ns/Praetorius/ViteAssetCollector/ViewHelpers"
>

<vite:asset
    entry="EXT:sitepackage/Resources/Private/JavaScript/Main.entry.js"
/>
```

## Advanced Example {#advanced-example}

```html
<html
    data-namespace-typo3-fluid="true"
    xmlns:vite="http://typo3.org/ns/Praetorius/ViteAssetCollector/ViewHelpers"
>

<vite:asset
    manifest="EXT:sitepackage/Resources/Public/Vite/.vite/manifest.json"
    entry="EXT:sitepackage/Resources/Private/JavaScript/Main.entry.js"
    scriptTagAttributes="{
        type: 'text/javascript',
        async: 1
    }"
    cssTagAttributes="{
        media: 'print'
    }"
    priority="1"
/>
```

**Arguments**

The following arguments are available for the asset ViewHelper:

-   **addCss**

    -   *Type:* boolean
    -   *Default:* true

    If set to "false", CSS files associated with the entry point won't be added to the asset collector

-   **cssTagAttributes**

    -   *Type:* array
    -   *Default:* array (
    )

    Additional attributes for css link tags.

-   **entry**

    -   *Type:* string

    Identifier of the desired vite entrypoint; this is the value specified as "input" in the vite configuration file. Can be omitted if manifest file exists and only one entrypoint is present.

-   **inlineCss**

    -   *Type:* boolean
    -   *Default:* false

    If set to "true", CSS will be added as inline \<style> tag. Note that this is currently experimental due to missing path rewriting for asset files.

-   **manifest**

    -   *Type:* string

    Path to your manifest.json file. If omitted, default manifest from extension configuration will be used instead.

-   **priority**

    -   *Type:* boolean
    -   *Default:* false

    Include assets before other assets in HTML

-   **scriptTagAttributes**

    -   *Type:* array
    -   *Default:* array (
    )

    HTML attributes that should be added to script tags for built JavaScript assets

-   **useNonce**

    -   *Type:* bool
    -   *Default:* false

    Whether to use the global nonce value
