8

I've observed that there are few base themes referenced when I create a new theme. For this example, I'll use the Basic2 theme.

Here is what I see selected on the theme:

Base Themes

Further exploration leads me to this list:

Base Themes

Questions:

  • Which feature provided by SXA is associated with each Base Theme? What breaks if something is removed?
  • Is there a table which outlines where each script is used by SXA? ie-origin-fix is a script included in the Core Libraries theme but I have no idea if it can be removed.
  • What is the recommended approach for teams to follow when a version of a library, such as jQuery, needs to be updated but SXA comes bundled with an older version?
  • Are there any scripts that are only needed in the Experience Editor but not on the live site and vice versa?
  • How can scripts for features not used on the page be excluded from loading altogether? For example, I'm not using the Carousel component so I want the associated scripts to be excluded.
3

Which feature provided by SXA is associated with each Base Theme?

  • Core Libraries - Everything will break ;). All libraries used by modules are stored here so this is a pretty important base theme. This is 1st on the DO NOT REMOVE list
  • Main Theme - observer.js is the most important script in this theme as it plays role in renderings registration and initialization process.
  • Google Maps JS Connector - one of the connectors (Google Maps JS Connector, Bing Maps JS Connector) required by Maps theme. Not needed if you are not going to use maps.
  • Maps - maps rendering will not work, it needs Google or Bing maps connector, that's why connector is added above this
  • Search Theme - search renderings will not work, you could skip if your page does not use search renderings
  • Media library - I think this is a bug, you should not have media library added as a base theme ;). AFAIK there should be an upgrade script which cleans this.

Is there a table which outlines where each script is used by SXA?

No, unfortunately not.

This particular script (ie-origin-fix) has a comment in the first line.

What is the recommended approach for teams to follow when a version of a library

It is hard to predict what will happen if you update library which is currently in use. You can take a risk and try to update but I would not do it.

This is not official recommendation, just my idea:

I would try to register it as a separate object without touching default and use the new version. With this approach, you will get new features and you are sure that old features will work.

At least you can be calm if something will not work in SXA because you know that it is not your fault.

Are there any scripts that are only needed in the Experience Editor but not on the live site and vice versa?

There is a concept of Editing Theme. Those themes are injected only in EE but I think that there are still scripts which are published on both modes while should be only in EE.

I don't recall any scripts that are present on the live site but not in EE, normally you want to use all features in EE as well as on live site.

How can scripts for features not used on the page be excluded from loading altogether?

Right now it is impossible. With Assets Optimizer all scripts are bundled together, thus you request only one file. Even though you disable AO all scripts will be served as they are stored in a Theme not in each feature.

It is an area for improvement as assets could be defined in the module by itself and register itself as a theme part.

If you want to do it by yourself you could try to register scripts on each rendering view. Each module could have its own theme which would be served only if rendering is present on the page (but you need to be aware of limited number of individual CSS in IE 9, IE 10 has solved this by increasing limit)

2
  • One more area of clarification. I've seen an issue where the script component-carousel.js shows errors in the console for themes built on 1.2-1.3. A new theme built on 1.4 does not throw the errors. How would you recommend someone upgrading component scripts when upgrading SXA versions? Jan 30 '18 at 20:55
  • @MichaelWest If you don't have any custom logic in renderings scripts I would simply do a PS sync and update all scripts using default base theme for new themes (Basic2). This is a solution for now. I would like to solve this problem in SXA by moving scripts into some base theme and provide an ability to overwrite something if needed. Feb 1 '18 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.