inklabs / kommerce-core

PHP shopping cart core platform
https://kommerce-laravel-demo.jamieisaacs.com/
Apache License 2.0
65 stars 14 forks source link

Reogranize themes #103

Closed jasonraimondi closed 7 years ago

jasonraimondi commented 7 years ago

Two new base theme groups, admin and storefront.

pdt256 commented 7 years ago

Current directory structure:

base-theme/{assets,scss,templates}
themes/
  bootstrap/{assets,scss,templates}
  cardinal/{assets,scss,templates}
  foundation/{assets,scss,templates}
  vintage/{assets,scss,templates}

New structure:

themes/
  foundation/{store/admin}/{assets,scss,templates}
  cardinal/{store/admin}/{assets,scss,templates}

Foundation becomes the new core theme. Cardinal is the Zen Kommerce default theme with design focusing on Zen Kommerce branding/images/colors.

New custom themes should be based off Foundation or Cardinal. Overriding the cardinal admin theme is optional when developing new themes. Themes are configured using config.php which returns a TwigThemeConfig. getBaseThemePath() may need to be altered or deprecated.

pdt256 commented 7 years ago

What happens when a custom theme wants to use the cardinal admin theme, then extend the foundation store theme?

pdt256 commented 7 years ago

We should place config.php low enough so store and admin have their own:

themes/
  foundation/{store,admin}/config.php
  cardinal/{store,admin}/config.php

or change TwigThemeConfig to select a parent theme for both store and admin:

themes/
  foundation/config.php
  cardinal/config.php
pdt256 commented 7 years ago

We should split @theme to @admin and @store.

foundation/templates/admin/product/edit.twig

{% extends '@theme/layout/base-admin.twig' %}

should become:

{% extends '@admin/layout/base.twig' %}

foundation/templates/product/show.twig

{% extends '@theme/layout/base.twig' %}

should become:

{% extends '@store/layout/base.twig' %}
pdt256 commented 7 years ago

@theme path is configured here: https://github.com/inklabs/kommerce-templates/blob/78e20eae9072a6b9ed87a2e7ccd34d3556fdba0d/src/Lib/TwigTemplate.php#L45

pdt256 commented 7 years ago

Choosing a theme should come from the configuration table instead of an environment variable. The admin user should be able to select a theme for store and admin.

This needs to be removed: https://github.com/inklabs/kommerce-laravel/blob/ae0128faf8754dab6a0107099fa7db8a52a2f689/.env.example#L28

We should create 2 config.php files for each theme. One for store and one for admin.

themes/
  foundation/{store,admin}/config.php
  cardinal/{store,admin}/config.php