Grav Theme Conceptualization

Grav’s themes encapsulate a great deal of functionality, in addition to appearance. I don’t know that this is good or bad, but it’s different that I think about a theme.

If you switch themes, I would not expect a switch in functionality, just appearance (font’s, colors, layout, etc.). Since Grav expects Javascript to be part of the theme, that might easily move functionality with a change in themes. Form validation, for example, might be done in JavaScript. Image carousels, jQueryUI stuff, and more.

I’m not suggesting a change, just starting a conversation about the concept and how folks are implementing JavaScript-based functionality in their projects.

I working on this some days ago, I like to add template___hooks but this is bad for performance because you add some cicle on the loading page for less time you edit your theme.

Grav is a little different from traditional CMS platforms such as WordPress and Joomla in that it’s core functionality is kept intentionally minimal. Really it just processes and caches a page structure. Any other advanced functionality is intended to be managed in optional plugins. This way we keep the core light and as minimal as possible for people that don’t need advanced features, but flexible enough that plugins can be created to provide power and features where needed.

One of the cool things about Grav is that it has the ability to provide an output layer using Twig that responds to .json, .xml, or whatever format you like. Just take a look at the SImpleSearch plugin. You can also provide custom pages, and even Twig templates in plugins too. This makes it easy to create really advanced functionality all powered by a plugin. If you start exploring Grav plugins, you will see that really the sky is the limit…