cb:assetPath 

  • Class: \TYPO3\CMS\ContentBlocks\ViewHelpers\AssetPathViewHelper

Resolves the public path to the assets directory of a Content Block. Use it together with the Core f:asset.css and f:asset.script ViewHelpers to include CSS and JavaScript files, which are shipped inside the Content Block itself.

Arguments 

Name Type Default Required
string
name
Type
string

The target Content Block name ( vendor/name ). If not set, the current Content Block is resolved automatically.

Examples 

Default usage 

Inside the current Content Block's own template, name can be omitted. The current Content Block is detected automatically.

<f:asset.css identifier="myCssIdentifier" href="{cb:assetPath()}/frontend.css"/>
<f:asset.script identifier="myJavascriptIdentifier" src="{cb:assetPath()}/frontend.js"/>
Copied!

Explicit Content Block name 

You can also point to the assets of a different Content Block by setting name explicitly.

<f:asset.script identifier="myJavascriptIdentifier" src="{cb:assetPath(name: 'vendor/name')}/frontend.js"/>
Copied!

See also