In a corporate publishing site, we are using composite looks to allow site managers to choose a branded color scheme.
Basically, we have branded the portal using two css files. A main.css
file that contains most of the rules, and which is located in the Style library
. And another theme.css
that contains all the rules that are dependent on the theme.
So the users can choose their color scheme using the "Change appearance" menu in site settings.
This is working quite well (some gotchas related to the system master page, but that's out of scope).
However, we have some changes to implements in the theme.css
file. Because of the composite look engine, the changes in this file won't be reflected until the theme is applied again.
Because there are many area in the portal, it's out of question to manually regenerate the theme on all sub sites.
Is there any way to force the regeneration of the theme?
If required, a powershell script can be used. I gave a try:
function ReapplyTheme{
param(
[Microsoft.SharePoint.SPWeb]$Web
)
$file=$web.GetFile($web.ServerRelativeUrl.TrimEnd('/') + "/_catalogs/theme/15/Palette_rouge.spcolor")
$theme=[Microsoft.SharePoint.Utilities.SPTheme]::Open("Name of my theme", $file)
$theme.ApplyTo($web, $false)
}
But this script breaks subsite. Moreover, color palette and theme name is hardcoded... Maybe there is somewhere to look after the values?