Skip to content
Jim Martens edited this page Feb 18, 2015 · 4 revisions

Cleared for editing

This page has the goal to determine how the style system will work.

IMPORTANT: The particular usage of different elements (controllers, templates, events, etc.) will be determined during early implementation to evaluate what works and what doesn't. Therefore this general idea will remain open until that time.

Layout

Alternative with styles providing the main template

Each style will provide a main layout with a minimum of required blocks. In each of those blocks will be a call to a service of the style system that gathers all template output for that particular block.

Each bundle with templates needs a TemplateService that utilizes the provided events as a listener to render the templates and add their output to the event object. This event object will then be used to collect the output of all bundles for that block. With this solution it is quite easy to implement the style system without sacrificing it's potency.

Alternative with styles being only CSS

There will be a main layout that contains a minimum of required blocks and a bare bone HTML body without any other markup. In each of this blocks but the main content block will be a call to a service/controller (depends on what works best) that generates the output of that block.

The main content block is filled by the controllers and subsequently by their corresponding templates, that inherit the main template.

Each style fills in predefined LESS variables and can add custom LESS code. This is loaded in the main template at the appropriate place.

Decision

After careful consideration the alternative with styles being only CSS/LESS is the way to go. First things first though: The decision is based upon the requirements for the style system.

Requirements:

  • fully customizable frontend
  • style change with a mouse click
  • no code changes

It was discussed whether a solution with style variables and custom LESS could satisfy these requirements. Given the fact that Symfony makes it possible to override each and every template of your vendors by placing the override template under app/Resources/views, it is possible to create a custom main layout for your website. Therefore such a thing is not needed for the style system. Another important factor is the time to realization. The chosen variant is far easier to implement and much more contained than the other could have been.

That said the alternative with CSS/LESS only and style variables will be used.