Created
February 1, 2018 17:35
-
-
Save michaellwest/babe14646ba4f261004e394ce93c9b5b to your computer and use it in GitHub Desktop.
Compare SXA themes with Sitecore PowerShell Extensions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get tenant theme | |
# Tenant Theme - change this to your desired ID | |
$siteTheme = Get-Item -Path "master:" -ID "{A8665181-7D76-4EEE-B5A3-923FD0671205}" | |
# Basic 2 Theme | |
$basicTheme = Get-Item -Path "master:" -ID "{B43D07BD-61D5-448F-9323-8B6ACAD4F3C4}" | |
# Compare scripts for matching name | |
$siteScripts = $siteTheme.Children["scripts"].Children | Select-Object -Property Name,ID | |
$siteScriptsLookup = $siteScripts | ForEach-Object { $lookup = @{} } { $lookup[$_.Name] = $_.ID } { $lookup } | |
$basicScripts = $basicTheme.Children["scripts"].Children | Select-Object -Property Name,ID | |
$basicScriptsLookup = $basicScripts | ForEach-Object { $lookup = @{} } { $lookup[$_.Name] = $_.ID } { $lookup } | |
# Report when script is different file size | |
$matchingScripts = Compare-Object -ReferenceObject $siteScripts -DifferenceObject $basicScripts -Property Name -IncludeEqual | | |
Where-Object { $_.SideIndicator -eq "==" } | Select-Object -Expand Name | |
foreach($matchingScript in $matchingScripts) { | |
$siteScript = Get-Item -Path "master:" -ID $siteScriptsLookup[$matchingScript] | |
$basicScript = Get-Item -Path "master:" -ID $basicScriptsLookup[$matchingScript] | |
if($siteScript.Size -ne $basicScript.Size) { | |
Write-Host "Version mismatch of $($matchingScript)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment