/**
* This prototype outputs the tag for including HTML, JS, MJS or CSS
*/
prototype(Carbon.IncludeAssets:File) < prototype(Neos.Fusion:Component) {
@propTypes {
file = ${PropTypes.string}
assetPackage = ${PropTypes.string}
cacheBuster = ${PropTypes.boolean}
disableCacheBusterForPreloadAsset = ${PropTypes.boolean}
assetPath = ${PropTypes.string}
wrapper = ${PropTypes.string}
}
file = ${null}
assetPackage = ${node.context.currentSite.siteResourcesPackageKey}
cacheBuster = ${Configuration.setting('Carbon.IncludeAssets.Default.CacheBuster')}
disableCacheBusterForPreloadAsset = ${Configuration.setting('Carbon.IncludeAssets.Default.DisableCacheBusterForPreloadAsset')}
assetPath = ${null}
wrapper = ${null}
// This is a internal variable, please use `assetPath` for an single file
paths = ${Configuration.setting('Carbon.IncludeAssets.Default.Path')}
@if.fileIsSet = ${this.file}
renderer = Neos.Fusion:Component {
@apply.props = ${props}
fileObject = ${Carbon.IncludeAssets.parseFilename(props.file)}
assetKey = ${this.fileObject.inline ? 'Inline' : 'File'}
type = ${this.fileObject.type}
isPlain = ${this.type == 'PLAIN'}
finalAssetPath = ${props.assetPath || props.paths[this.assetKey][this.type]}
path = ${this.fileObject.external || this.fileObject.path ? this.fileObject.filename : this.assetPackage && this.finalAssetPath ? 'resource://' + this.assetPackage + '/' + this.finalAssetPath + '/' + this.fileObject.filename : false}
path.@if.isNotPlain = ${!this.isPlain}
@if.hasPath = ${this.isPlain || this.path}
renderer = Neos.Fusion:Case {
@process.wrapper = Carbon.IncludeAssets:Internal.Wrapper {
wrapper = ${props.wrapper}
}
isPlain {
condition = ${props.isPlain}
renderer = ${props.fileObject.markup}
}
inlineFile {
condition = ${props.fileObject.inline}
renderer = Carbon.IncludeAssets:Internal.InlineFile {
attributes = ${props.fileObject.attributes}
path = ${props.path}
type = ${props.type}
}
}
isFile {
condition = ${props.path ? true : false}
renderer = Carbon.IncludeAssets:Internal.TypeCase {
type = ${props.type}
css = afx`
`
js = afx`
`
preload = afx`
`
modulePreload = afx`
`
}
}
}
}
}