-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Package.fusion
55 lines (50 loc) · 2.38 KB
/
Package.fusion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* This prototype include all assets of a package
*/
prototype(Carbon.IncludeAssets:Internal.Package) < prototype(Neos.Fusion:Component) {
// Body || Head || BodyStart || HeadStart
location = ${null}
// The config for the package
config = Neos.Fusion:DataStructure
// Is this package rendererd in Monocle?
monocle = false
// Internal property
mergedConfig = ${Array.concat(Configuration.setting('Carbon.IncludeAssets.Default'), this.config)}
sitePackageKey = ${this.monocle ? sitePackageKey : node.context.currentSite.siteResourcesPackageKey}
renderer = Neos.Fusion:Component {
@if.hasCustomCondition = Neos.Fusion:Case {
custom {
condition = ${props.mergedConfig.ConditionPrototype && Type.isString(props.mergedConfig.ConditionPrototype)}
type = ${props.mergedConfig.ConditionPrototype}
}
default {
condition = true
renderer = true
}
}
assetPackage = ${props.mergedConfig.Package == 'SitePackage' ? props.sitePackageKey : props.mergedConfig.Package}
cacheBuster = ${props.mergedConfig.CacheBuster}
disableCacheBusterForPreloadAsset = ${props.mergedConfig.DisableCacheBusterForPreloadAsset}
paths = ${props.mergedConfig.Path}
wrapper = ${props.mergedConfig.Wrapper}
collection = Neos.Fusion:Map {
items = ${String.split(props.mergedConfig.Order, ',')}
itemRenderer = Neos.Fusion:Value {
condition = ${props.monocle ? item != 'Backend' : (item == 'General' || (item == 'Backend' && node.context.inBackend) || (item == 'Live' && node.context.live))}
value = ${this.condition ? props.mergedConfig[item][props.location] : false}
@process.convertToArray = ${Type.isString(value) ? String.split(value, ',') : value}
}
@process.filter = ${Array.filter(Carbon.Array.extractSubElements(value))}
}
renderer = afx`
<Carbon.IncludeAssets:Collection
assetPackage={props.assetPackage}
cacheBuster={props.cacheBuster}
disableCacheBusterForPreloadAsset={props.disableCacheBusterForPreloadAsset}
collection={props.collection}
paths={props.paths}
wrapper={props.wrapper}
/>
`
}
}