Basic Gallery Squares

How do you use the Basic Gallery Squares Mod multiple times where one edit does not edit the others on a different page?

You can clone it and add the code for the 2nd one :smile:. Then it is 2 different mods that you can edit differently.

I am using the same Mod several times on the same page too!

Additionally I am using that same mod across six pages. It is an image-text content mod.

Consequently,

This is a relevant question for me too.

I might use the same mod approx. 15 times within the same project. That means I have the same css and js 15 times.

This quickly turns into a hassle the moment I aim to edit something in the code. No matter if I change the html or js or css.
Also : if anymod will be updating their codebase for their original template mod for my mod beeing used multiple times. … I will also have to update those 15 mods manually

Hi Stefan, it sounds like you might want some kind of “bulk merge”, where you can push changes in the code to other mods in your project as a group. Is that something that would help?

The idea seems neat. But looking at my code, the CSS is not completely the same inside all of those “almost-identical-Mods” , although they are 99% the same. The CSS is not 100% the same because I sometimes need to add some extra margin-top to one of those mods, and inside other mods the position of the images needs to be overwritten by new individual rules, and so on and so forth. Thus, the CSS is not 100% the same. For that reason, it might not be best to simply bulk-overwrite the entire CSS all across all of those those “almost-identical-Mods” (if that is what you suggested??).

Also your solution would still leave the project with having 15 times the same CSS, which is not only unnessesary , but also not the cleanest solution.

So, what I thought about was rather ONE CORE Css File I might want to use whenever I run the same mod more often than once. That one CSS-File might be dropped into the mod as an external css-source and then imported by an @import rule (for the admin-user to quickly see the imported CSS-sources!! (currently It is a bit too hard to see the external css-sources the Mod is actually using)

In more detail, this is how I went about inside of my current project to adress the issue of multi-Mods within the same project: I deleted the css for the mods out of the MODs! and pasted it into a global css file (on my local server in my case) ( and I added it to the HEAD in the html of the webpage. I did NOT import the CSS-file via the@import rule within the css-section of my 15 Mods . I think I was a bit too lazy or maybe I did not yet think about the solution enough at that time :slight_smile: . Anyway, this is what I did within my current project to “solve” this problem . I just created a css File and added the css to the HEad of my documents.

In order to accieve this I had to rename all CSS-Rules for them to apply not only to the One Mod-ID, but to all relevant mods . Most of the time I used
#anymod-ralakm div .image-background,
#anymod-dknklo div .image-background,
#anymod-nkrklm div .image-background { … }

So my idea would be to have an external CSS and apply that one css-file to all of my (almost) identical Mods. This way I can still overwrite specific individual Rules by simply adding those individual rules to the css-pane of the MOD itself.
Also, if anymod provides an Update to that MOD, then I might not want to touch the css inside of the CSS-pane-inside of that MOD, but I would instead update the external CSS .

PS:
For my THEMING I used a more global approach : I wanted my entire webpage to have a global theme and started to try and overwrite some selectors this way:
div[id*=‘anymod-’].a01 h2,
div[id*=‘anymod-’].a01 h3 {

}
I had to specify the selectors very specifically, because otherwise the rules would not overwrite the bootstrap-css. But theming is a different topic :wink:

I hope this report can be of some help.

1 Like

Hi Stefan, this is really helpful. Thank you! We have been discussing different ways to manage the CSS between different (but similar) mods and the live page vs the dashboard. This is great input for that discussion!

Yes. The idea might have some similarities to the Cild-Theme-logic in WordPress, in a certain way.