Dear developers,
firstly let me congratulate the team on the great advancement that have been made on improving the theming of LimeSurvey. For several customers, both existing, as well as new ones, this has proved to save time.
The possibility to inherit theme structures (like views, js and variables) proves to be very strong and helpful.
BUT.....
For developing a theme that can work on different versions of LS 3.x, a theme that can be used by (paying or non-paying) still some work must be done. The main reason for that is, to my opinion, the current vanilla theme still has too many classes and constructs in it to function as a good clean sheet to start from.
I ran into this when I started to develop a theme as a child of vanilla. In several cases I ran into classes that were defined for the ease of the original developers, but that obstruct the developers of new themes.
For example, classes like .space-col, that are inserted for easy adding some space to certain building blocks, hinder further development. Here I could have chosen several approaches.
- neutralize the .space-col in custom.css. This will result in some work, because just stating: .space-col{all margins=0} will not work correctly. .space-col is often used together with some other classes, like h3 and LS-classes, which have their own margins and paddings. Neutralizing .space-col will raise the need for re-adjusting those other classes, which will result in a lot of extra css-lines.
- copy the .twig files that hold the superfluous classes to my own custom theme and adjust these. This is the most clean approach, but when the vanilla theme, on which the custom theme is changed, this may result in unwanted effects in the custom theme and the need to adjust this for different versions of LimeSurvey.
- delete the superfluous classes with javascript, using statements like: $("*").removeClass( "space-col" ); This works and helps a lot, but it slows down the page loading and it looks unprofessional to see a page build up and then change several things (because .space-col is in my case not the only unwanted class). Furthermore it clutters both the base theme as well as the custom theme with code and reverting code.
- Other approaches? Please add...
When all this development into "twigging" the themes started, back in 2016, I hoped that these new development would result in a solid basis for other developers to build their solutions on. I also think that this solution is within reach, but still needs some work. I am willing to contribute to that, but before doing so, I would like to know if this work will have a chance to be accepted.
My approach would be the following. Either define a new template (something like "clean" or "base") or change the already existing "vanilla" into a real clean sheet:
- the new template is not intended to be used as a survey template. It will function, but it will look completely unstyled, no margins, no paddings, no fonts, no colors.
- the new template will not hold question subtemplates, it will hold exactly the same templates as are available in "vanilla"
- all classes that are designer decisions will be taken out. These are classes like: .space-col, but also: .text-center, .text-primary
- constructs for adding icons, will be solved in .css (using :before) and not in templates.
- I realise that there are blurred boundaries here: in fact all Bootstrap related classes could (should?) be taken out, whereas the developer could use @extend to add Bootstrap (or another framework) behaviour, based on semantic classes from LS. But I do not want to be as strict as that. I would propose that only Bootstrap classes that relate to pure (?) layout and responsive behaviour should be in and to leave the styling of custom templates completely to the theme developer.
The resulting theme.css in the clean base theme can then also be very small, with minimal need to override this from the custom.css in the custom theme.
Same for the templates and javascript files.
Would this work as an approach for now or for the upcoming LS4?