Skip to content

Commit

Permalink
New: Add Carbon.IncludeAssets:MonocleAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnitto committed Apr 13, 2021
1 parent a0bd3fd commit 3619710
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Resources/Private/Fusion/External/MonocleAssets.fusion
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prototype(Carbon.IncludeAssets:MonocleAssets) < prototype(Carbon.IncludeAssets:Internal.Assets) {
prototype(Carbon.IncludeAssets:Case) {
alwaysInclude = true
}

prototype(Carbon.IncludeAssets:Internal.Package) {
monocle = true
}
}
8 changes: 6 additions & 2 deletions Resources/Private/Fusion/Internal/Package.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ prototype(Carbon.IncludeAssets:Internal.Package) < prototype(Neos.Fusion:Compone
// 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 {
Expand All @@ -22,15 +26,15 @@ prototype(Carbon.IncludeAssets:Internal.Package) < prototype(Neos.Fusion:Compone
renderer = true
}
}
assetPackage = ${props.mergedConfig.Package == 'SitePackage' ? node.context.currentSite.siteResourcesPackageKey : props.mergedConfig.Package}
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 = ${item == 'General' || (item == 'Backend' && node.context.inBackend) || (item == 'Live' && node.context.live)}
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}
}
Expand Down

0 comments on commit 3619710

Please sign in to comment.