I am using Sitecore 9.1 and SXA 1.8, I need to clone "component-search-results-count.js" in base theme to extend some functionality to the OOB "Search Result Count" component.
How can I do that?
1 Answer
The way I do this is to create a copy of the JavaScript file, in this case component-search-results-count.js
and add that to my theme, or create a custom base theme.
As for the base theme, I normally make a copy of it, for example, the Components Theme
, then I use my copy as the base theme for my sites theme, instead of the OOTB version. This means I can then remove any files that I override without touching the OOTB base theme.
The reason, I add the files to the theme instead of just modifying the ones in my copy of the base theme, is so that I can easily use Creative Exchange to import the modified files. Creative Exchange does not import any of the files in the base themes.
Of course, you can always just remove the files from the OOTB Base Theme, but then you would have to make sure that you replicate that on each upgrade.
-
thanks, I think it is good approach of copying base theme. But i have a confusion here If I want to create a copy of the JavaScript file and add that to my theme how i make sure that copy file is used not OOTB file in base theme. Oct 17, 2019 at 6:13
-