Recommendations: Working with themes

Abstract

Organize classes and assets for your themes.

This topic describes the following best practices for extending your themes.

Make a copy, modify your copy, and then inherit from the copied theme instead of from the original one. This practice is merely a reinforcement of the following practices:

  • Never put any custom items in SXA controlled branches of the tree.

  • Do not modify the OOBT SXA items.

If you do not follow this recommendation while extending SXA, you risk getting your changes overwritten the next time you upgrade SXA.

If you create a custom style for a rendering, make sure you assign it to the correct renderings.

For example, if you provide a style that is specific to your Promo rendering but you do not want other renderings to use that style, you can achieve this by listing renderings that the style applies to in the style item, in the Allowed Renderings field. If you do not assign the style to any rendering, it is available for every rendering.

image1.png

Remove unused styles from the styles folder. It can be frustrating for a editor of your site to apply a style only to find out that it made no change to the style of their rendering. SXA includes a number of PowerShell scripts to automate the most common tasks. Right-click the Styles item, and then click Scripts to find a clean-up script.

image2.png

As you deliver the site branding and theme, you can expect your site styles list to grow rapidly. Consider organizing the styles into subfolders to avoid overwhelming your editors with a long list of uncategorized styles.

image3.png

SXA includes a number of PowerShell scripts to automate the most common tasks. Right-click the Styles item, and then click Scripts to find the Organize styles script.

image4.png