There are some JS assets duplicated in koha-tmpl/intra-tmpl and koha-tmpl/opac-tmpl. 100% match: ./koha-tmpl/opac-tmpl/bootstrap/js/i18n.js ./koha-tmpl/intranet-tmpl/js/i18n.js 100% match: ./koha-tmpl/opac-tmpl/bootstrap/js/Gettext.js ./koha-tmpl/intranet-tmpl/js/Gettext.js ~95% match: ./koha-tmpl/opac-tmpl/bootstrap/js/coce.js ./koha-tmpl/intranet-tmpl/js/coce.js ~95% match: ./koha-tmpl/opac-tmpl/bootstrap/js/cookieconsent.js ./koha-tmpl/intranet-tmpl/prog/js/cookieconsent.js ~80% match: ./koha-tmpl/opac-tmpl/bootstrap/js/ill-availability.js ./koha-tmpl/intranet-tmpl/prog/js/ill-availability.js ~50% match: ./koha-tmpl/opac-tmpl/bootstrap/js/basket.js ./koha-tmpl/intranet-tmpl/prog/js/basket.js Some of the differences in the above pairs may have been due to requirements specific to only staff or to only OPAC, or it may also have been the case that they have fallen out of sync over the years with some enhancements being added to one of the pair and not the other. I don't know what the best solution for this would be (if one is needed) but developing bug 35604 I need to have the same JS file on both intra and OPAC and feels bad to have to copy the same file to 2 different places. I'm only looking for JS files but I know this is also the case for images, maybe some CSS and other assets. Could we consider having a koha-tmpl/shared-tmpl directory, or have some of these overlapping assets only exist once and have them be duplicated for each interface during build, or yet another better option?
Created attachment 164381 [details] [review] Bug 35716: PoC **K-T-D TEST ONLY** At /kohadevbox/koha, run the following: - sudo cpan File::Copy::Recursive - sudo rm -rf /usr/share/koha - sudo perl Makefile.PL # press Enter on all prompts - sudo make install - find /usr/share/koha -name hello.js Notice the output: /usr/share/koha/opac/htdocs/opac-tmpl/js/hello.js /usr/share/koha/intranet/htdocs/intranet-tmpl/js/hello.js My first attemp was using the file_map that is used to PM but I failed. Even changing the code to allow for multiple targets in the file_map, the WriteMakefile will always only map 1 to 1 from the PM hashref. But PL_FILES allows for an array of destinations given one source. This patch needs more work as a SHARED_TMPL_DIR env variable would be ideal, amongst other improvements, but this is just a proof of concept to have others look at and see if they agree with this approach.
Changing to NSO to get more eyes on it.
I love the idea here - it's frustrating that we have to maintain two sets of files for the same purposes - this could go along way towards standardizing more of what we do
I love the direction here though I wonder what you mean by a SHARED_TMPL_DIR environment variable? I wonder if we could perhaps use some symlinking for development so one doesn't have to run make to test changes to these files?.. not sure if there would be a performance implications in live running using symlinks Vs hard files either on that front. Thanks for raising this again Pedro.. sure we must be able to resolve this age old problem by now
https://gitlab.com/koha-community/Koha/-/blob/main/C4/Templates.pm?ref_type=heads#L52 I feel like we could do something here perhaps.. so instead of make copying to two places, we have a shared directory at the top level where we look for included including translated ones after we've looked in the more localised for themes version of the same files?
I think this is a great idea! It makes no sense to me to have duplicates, and then need to remember to update in two places when changes are made. If they only relate to the staff and OPAC templates, maybe just having a shared folder under koha-tmpl would be sufficient (as proposed in comment #1? Bearing in mind I don't understand all the nuances (such as for translation, or custom templates) , maybe that is too simplistic...