Documentation · ViewHelper reference

XSD schema file | vhs 2.1.3


Basic Asset ViewHelper

Places the contents of the asset (the tag body) directly in the additional header content of the page. This most basic possible version of an Asset has only the core features shared by every Asset type:

  • a "name" attribute which is required, identifying the Asset by a lowerCamelCase or lowercase_underscored value, your preference (but lowerCamelCase recommended for consistency).
  • a "dependencies" attribute with a CSV list of other named Assets upon which the current Asset depends. When used, this Asset will be included after every asset listed as dependency.
  • a "group" attribute which is optional and is used ty further identify the Asset as belonging to a particular group which can be suppressed or manipulated through TypoScript. For example, the default value is "fluid" and if TypoScript is used to exclude the group "fluid" then any Asset in that group will simply not be loaded.
  • an "overwrite" attribute which if enabled causes any existing asset with the same name to be overwritten with the current Asset instead. If rendered in a loop only the last instance is actually used (this allows Assets in Partials which are rendered in an f:for loop).
  • a "debug" property which enables output of the information used by the current Asset, with an option to force debug mode through TypoScript.
  • additional properties which affect how the Asset is processed. For a full list see the argument descriptions; the same settings can be applied through TypoScript per-Asset, globally or per-Asset-group.

Note: there are no static TypoScript templates for VHS but you will find a complete list in the file in the root of the extension folder.

  • Tag usage example

    <v:asset content="NULL" path="NULL" external="1" name="NULL" overwrite="1" dependencies="NULL" group="'fluid'" debug="1" standalone="1" rewrite="1" fluid="1" arguments="[mixed]" variables="[mixed]" allowMoveToFooter="1" trim="1" namedChunks="1">
    	<!-- tag content - may be ignored! -->
  • Inline usage example

    {v:asset(content: 'NULL', path: 'NULL', external: 1, name: 'NULL', overwrite: 1, dependencies: 'NULL', group: ''fluid'', debug: 1, standalone: 1, rewrite: 1, fluid: 1, arguments: [mixed], variables: [mixed], allowMoveToFooter: 1, trim: 1, namedChunks: 1)}


Argument Description Type

If TRUE, allows this Asset to be included in the document footer rather than the header. Should never be allowed for CSS.


DEPRECATED. Use argument variables instead


Content to insert in header/footer


If TRUE, outputs information about this ViewHelper when the tag is used. Two master debug switches exist in TypoScript; see documentation about Page / Asset ViewHelper


CSV list of other named assets upon which this asset depends. When included, this asset will always load after its dependencies


If TRUE and standalone, includes the file as raw URL. If TRUE and not standalone then downloads the file and merges it when building Assets


If TRUE, renders this (standalone or external) Asset as if it were a Fluid template, passing along values of the "arguments" attribute or every available template variable if "arguments" not specified


Optional name of a logical group (created dynamically just by using the name) to which this particular asset belongs.


Optional name of the content. If multiple occurrences of the same name happens, behavior is defined by argument "overwrite"


If FALSE, hides the comment containing the name of each of Assets which is merged in a merged file. Disable to avoid a bit more output at the cost of transparency


If set to FALSE and a relocated string with "name" already exists, does not overwrite the existing relocated string. Default behavior is to overwrite.


If not using tag content, specify path to file here


If FALSE, this Asset will be included as is without any processing of contained urls


If TRUE, excludes this Asset from any concatenation which may be applied


DEPRECATED. Trim is no longer supported. Setting this to TRUE doesn't do anything.


An optional array of arguments which you use inside the Asset, be it standalon or inline. Use this argument to ensure your Asset filenames are only reused when all variables used in the Asset are the same

Required attribute

Revision history

commit 8ca8aa511c673ff77ab905de14fd94c11a593d53
Author: Claus Due <*****>
Date:   Sun Jan 20 02:10:17 2013 +0100

    [FEATURE] Basic Asset ViewHelper and page rendering hooks

commit ac09ad4caeafe7520a05da553452b0cf88e4cf44
Author: Claus Due <*****>
Date:   Sun Jan 20 13:39:15 2013 +0100

    [FEATURE] Merge support, AbstractAssetViewHelper
    Adds merging of Assets of the same type as long as assets are not marked "standalone". If a group of interdependent Assets contains one standalone Asset in the middle of the dependency list, two merged files and one standalone will be generated, i.e.:
    1. chunk of merged code up until the standalone Asset
    2. a single standalone Asset inclusion
    3. the remaining chunk of merged code after the standalone Asset
    Any number of standalone Assets may be introduced. Standalone status can be set through TypoScript on groups of Assets or individual Assets. Dependency order will be respected regardless.

commit 5c19ca9d8c104abdf777e33af1bf6edfe9efd0a1
Author: Claus Due <*****>
Date:   Sun Jan 20 14:02:29 2013 +0100

    [FEATURE] Clearing of merged Assets on cache clear

commit f5995ecfe44075ce772752980f406f25f98f566a
Author: Claus Due <*****>
Date:   Sun Jan 20 14:03:10 2013 +0100

    [FEATURE] Attributes "trim" and "namedChunks" on AbstractAssetViewHelper

commit 3f52a505b25f4f32066561cad2100277a7e2366f
Author: Claus Due <*****>
Date:   Sun Jan 20 14:27:04 2013 +0100

    [DOC] Adjusted doc comment of Asset ViewHelper

commit 672ae567cfd9f0f632643b7f8127f1d8a5cd8ded
Author: Claus Due <*****>
Date:   Sun Jan 20 15:21:17 2013 +0100

    [BUGFIX] Correct handling of file merges/inclusions

commit 88644610b95de09e5800f6ee8a7a0a9939ec4851
Author: Claus Due <*****>
Date:   Sun Jan 20 15:27:21 2013 +0100

    [FEATURE] Add "external" attribute on AbstractAssetViewHelper
    Setting this boolean flag to TRUE causes the Asset to be considered external, remove.
    If an Asset is added by path and the path is remote, but "external" is NOT enabled, the Asset source is downloaded and merged with the other files. Which means that for CDN sources you simply **must** use "external" (also when, for example, overriding paths in TypoScript to use CDN sources).

commit 187178103c613358cfe0acc4d8ccd7a57455be2a
Author: Claus Due <*****>
Date:   Sun Jan 20 16:00:06 2013 +0100

    [BUGFIX] Only throw Exception if file does not exist and Asset is NOT external

commit 6caaa1ffa08d3c597406dc3dc50aa8f4dcc010e2
Author: Claus Due <*****>
Date:   Sun Jan 20 17:46:52 2013 +0100

    [TASK] Grouping of condition in AssetViewHelper isExternal assertion

commit d2c67d9fa46bf4e37de6e52d64ea204ed40770ff
Author: Claus Due <*****>
Date:   Sun Jan 20 20:09:15 2013 +0100

    [BUGFIX] Allow Asset chunks to be raw strings
    This is necessary to accommodate merged chunks of tag content which may have been added by preceding Assets.

commit 6418ce6eb6193b6a85c6a5249cee848ca7a6bab2
Author: Claus Due <*****>
Date:   Sun Jan 20 20:17:47 2013 +0100

    [BUGFIX] Proper accumulation of merge able Asset chunks when split by standalones

commit 2bda0229b0734b8d3b5fe906ff7bf5d2e936f33b
Author: Claus Due <*****>
Date:   Sun Jan 20 22:27:00 2013 +0100

    [FEATURE] Rendering using Fluid for Fluid-enabled Assets
    Requirements: "path" must be used, "fluid" must be enabled. And very most likely, "arguments" must be added to transfer some arguments.

commit 1d80634ceb33c012d83a92cb21ff09a1fa948b4d
Author: mostwanted1976 <*****>
Date:   Wed Jan 30 21:14:47 2013 +0100

    [TASK] Check if $files is array in clearCacheCommand() of AssetViewHelper

commit a7251fddf332560ac880870a0d50e74cbf4b077a
Author: Claus Due <*****>
Date:   Thu Jan 31 23:33:26 2013 +0100

    [BUGFIX] Employ dual Asset hook to support case of zero USER_INT objects

commit f7395f10e5d7099995de4730cf6d0c0e3f9813e2
Author: Claus Due <*****>
Date:   Sat Feb 2 19:30:39 2013 +0100

    [BUGFIX] Treat USER and USER_INT individually and ignore BE user

commit b34cfdd1dfd1b1c8fa65b57ccbe52863f91ce638
Author: Claus Due <*****>
Date:   Sun Feb 3 00:39:29 2013 +0100

    [BUGFIX] Avoid warning on assumed existing Asset cache file

commit 0ba9dfa9bd16ed3c0f84dbb1cc9d941565ee991b
Author: Claus Due <*****>
Date:   Sun Feb 3 01:01:31 2013 +0100

    [BUGFIX] Preserve parent caller reference in Asset hook

commit 03ef34b45c6e9fae8e078b9adb598088167037b3
Author: Claus Due <*****>
Date:   Sun Feb 3 04:07:10 2013 +0100

    [TASK] Simplify Asset cache file writing

commit e1f33e86d0c6e517ff6042ba1a04a14a82e1ac0b
Author: Claus Due <*****>
Date:   Sun Feb 3 16:45:58 2013 +0100

    [TASK] Discard cache clear hook processor for Assets

commit bbc8cb7495439eeebc9cf80f018a06b9b7dff76a
Author: Claus Due <*****>
Date:   Sun Feb 3 22:27:34 2013 +0100

    [TASK] Allow uncached Assets to depend on cached Assets

commit 03a86b932ed210bbd3a67a35d55bdfd299f2076a
Author: Claus Due <*****>
Date:   Wed Feb 6 19:39:17 2013 +0100

    [BUGFIX] Correctly remove temporary Assets dependencies HTML comment
    Fixes: #48

commit f1f11cadec057a8e69fa8a777d145caf1af2b786
Author: Fabien Udriot <*****>
Date:   Wed Feb 6 19:02:39 2013 +0100

    [FEATURE] Improve asset linking
    * To avoid un-wanted caching by the browser, append a time stamp
    to a file based on the modification time.
    * Add support of "absRefPrefix" TS configuration which prepends a file path.

commit 764d7961d8807b8d9e23d8d8cdb77ff8a1a4e3a5
Author: Claus Due <*****>
Date:   Sun Feb 10 00:27:40 2013 +0100

    [TASK] Refactor to implement AssetInterface

commit 8084d6e4aebd82d1c5bd08f69f7447b403e65da3
Author: Claus Due <*****>
Date:   Sun Feb 10 14:00:39 2013 +0100

    [FEATURE] Compilable Assets
    This feature consists of:
    * An interface for CompilableAsset
    * An interface for AssetCompiler
    * An abstract CompilableAsset ViewHelper
    * An abstract AssetCompiler ViewHelper
    * An additional processing step while sorting Assets
    The feature works by postponing building of CompilableAssets until every Asset has been sorted. The CompilableAssets are grouped by their relationship to an AssetCompiler which is inserted and configured as an Asset ViewHelper [1] which is used to render all related CompilableAssets.
    [1] Note that this means AssetCompilers as well as CompilableAssets can be configured through TypoScript in the same level of detail as any other Asset type.

commit 839f1bbac051f7a6912d9eca2627a739f23cc7de
Author: ste101 <stephan_*****>
Date:   Sun Feb 17 22:15:30 2013 +0100

    Update Classes/ViewHelpers/AssetViewHelper.php
    forceClosingTag causes an HTML validation error.

commit 3bc8a9c15804f46465f53c269c5b0d550a1be43c
Author: Beda Steinacher <*****>
Date:   Tue Feb 19 13:59:33 2013 +0100

    [BUGFIX] Fluid Assets overwrites written merged assets
    Fixed by appending rendered fluid asset
    Fixes: #34

commit 3080a0eba943a3c6f65984e960ac9eb77fceb63a
Author: Claus Due <*****>
Date:   Tue Feb 19 21:39:22 2013 +0100

    [FEATURE] Configurable "use hashed name" for merged Assets file

commit 96ad1f48f042ed6e8134fd0321cdb3f7363255ee
Author: Claus Due <*****>
Date:   Tue Feb 19 21:41:17 2013 +0100

    [TASK] Clean up targeting of uncached Asset placeholders

commit cb32360aa9caa8c71f21530014610aa0e53ddaa2
Merge: 4d73c98 839f1bb
Author: Claus Due <*****>
Date:   Tue Feb 19 13:27:16 2013 -0800

    Merge pull request #67 from ste101/patch-1
    [BUGFIX] AssetViewHelper: forceClosingTag causes an HTML validation error

commit 3489f1df7df96a0cb2f9216aac8c2070e60d8ebc
Author: Fabien Udriot <*****>
Date:   Wed Feb 20 21:41:11 2013 +0100

    [BUGFIX] force close tag "script"
    Tag "script" must be closed for not messing up the page. Actually, the
    self-closing XML syntax <script /> is correct XML, but for it to work
    in practice, the web server also needs to send the XML mime-type
    like application/xhtml+xml and not as text/html which is not something
    we want by default.

commit 15770822150e62de992587bd61efb6532c05ab9b
Author: Claus Due <*****>
Date:   Tue Mar 26 18:27:45 2013 +0100

    [TASK] Set raw Asset's standalone attribute default to TRUE

commit b64e65b5b4dca7dc8472e7115243f093121c1dbc
Author: Claus Due <*****>
Date:   Fri Apr 5 23:46:30 2013 +0200

    [FEATURE] Rewrite and cache files referenced by CSS files
    This parses CSS sources when not included as standalone files, caching and relocating files referenced from the CSS such as background images and imports.
    Does not work recursively, i.e. does not parse imported files for additional referenced files. F*****@import statement get copied to typo3temp but any resources therein do not get copied.

commit 218d76168499907a1fcf1c6557b7a18801c5cdde
Author: Björn Fromme <*****>
Date:   Wed Apr 10 22:48:39 2013 +0200

    [TASK] Remove unused variable

commit 7341b52b4f3a881c017acee8ca32b67a45ca9864
Author: Björn Fromme <*****>
Date:   Wed Apr 10 22:53:57 2013 +0200

    [FEATURE] Add support for query hacks in CSS font urls

commit 812925e3b1be49d9c8b7a75bab5fbc815c00601d
Author: Claus Due <*****>
Date:   Wed May 22 00:06:43 2013 +0200

    [TASK] Cleanup as required by coding standards
    Excuse the not-using-PR-direct-to-master commit approach but this one is merely cosmetic in nature and the Travis build is failing because of it.

commit aa32ca2050a4ac2d8ff0a2183b316c7c0f2477ed
Author: Björn Fromme <*****>
Date:   Sun May 26 16:00:15 2013 +0200

    [TASK] A*****@throws annotations

commit 2bb0614e8cdb3ccef954a51c0130e8fe3f6f6cd5
Author: Claus Due <*****>
Date:   Sun Jun 9 01:01:53 2013 +0200

    [TASK] Refactor Asset handling into new AssetService

commit 2019e541fb0ae7c8e8851725f99090dbdff2ab23
Author: Matthias Gugel <*****>
Date:   Sat Oct 19 04:35:09 2013 +0200

    [TASK] Remove empty lines and ?> from end of files

commit da31bad1d9bb058c072ddb5591e8ed907a1ae8e1
Author: Claus Due <*****>
Date:   Tue Dec 31 23:08:37 2013 +0100

    [TASK] Happy new year!

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit 4981055359c895f3869e5bd878293b3c15ed26e5
Author: Xaver Maierhofer <*****>
Date:   Sun Jan 18 14:01:04 2015 +0100

    [TASK] CGL - Define classes, params, use imports

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to file