Re: Separate "Sources" and "Themes" in js too?
Reply #19 – March 21, 2013, 04:40:11 pm
Notepad++ does it rather elegantly, but even so it's still not that clever for this.
Re: Separate "Sources" and "Themes" in js too?
Reply #22 – March 21, 2013, 06:57:27 pm
emanuele
Global Moderator
I agree that proper and meaningful separation is difficult to achieve. What I think, though, is that have all the template elements as close as possible is better than have them spread all over the places. I think started this topic because I realised there are (or there were) theme elements in script.js (I think) left from before the rework of the theme for 2.1 and not changed. Why? It's not important. So, from that the "idea" to have all (or at least most) of the "presentation" in one single place instead of spread all over the places (because at the moment it is spread over at least 3 to 5 files). Nothing too complex, nothing too fancy. css is for sure a quite different beast.
Re: Separate "Sources" and "Themes" in js too?
Reply #25 – August 09, 2014, 08:16:09 am
emanuele
Global Moderator
Bump for great justice. Back to the original topic, without all the wandering about files, my original intent was: script.js => does stuff theme.js => shows stuff scripts.js calls theme.js to finds out *how show certain stuff. That's all I am thinking to achieve. And since we are adding some stuff "js-only", I think it's a good moment to start thinking at least of a general structure...
Re: Separate "Sources" and "Themes" in js too?
Reply #28 – August 22, 2014, 01:20:20 am
I have used JS template engines before but for Elkarte, I can't imagine there are many times when you'll want to use a template from the backend instead of just adding another div or row to a table. In that case, just get the last one, duplicate it, and then change the content. Less things to keep track of.
Re: Separate "Sources" and "Themes" in js too?
Reply #29 – August 23, 2014, 07:56:52 am
emanuele
Global Moderator
Yeah, I used that approach in some places, but honestly it's a mess. It works if you have to add just a couple of things, but for mid-complex stuff it's basically impossible. For example I was thinking to use that approach for my infinite-scrolling trick, but clone the post/poster area and replace the stuff is a nightmare...