benmanu / silverstripe-styleguide

Generates a styleguide for a SilverStripe theme.
BSD 3-Clause "New" or "Revised" License
10 stars 9 forks source link

Allow extension so modifier classes so they can be managed in a yml file #11

Open mandrew opened 8 years ago

mandrew commented 8 years ago

Some of the ss.org components have over 20 (and growing) modifier classes and they are being managed on a separate .yml file and then being fed into the CMS so they can be updated by an admin. It would be great to extend the existing modifier class code so I can point it to the existing list rather then having to update the classes in two places.

benmanu commented 8 years ago

Hey @mandrew, would it be possible to see the format that you have setup in the .yml file for these class names? I definitely want to cut down double ups of code where possible and as I'm not set to any structure would be good to see how it can fit with your use case.

mandrew commented 8 years ago

Here is an example of the code in config.yml:

ContentComponent:
  style_variants:
    text-image: 'Text / half image'
    text-image-grey: 'Text / half image (grey background)'
TableComponent:
  style_variants:
    grey: 'Grey background'
    dark: 'Dark background'
    banner-dark: 'Background image darken'
    banner-light: 'Background image lighten'
    banner-dark-birds: 'Background image dark with birds'

Each component in the cms has the ability to access a dropdown of their style_variants variables in config.yml. Once chosen, then the class "component-{style_variants}" gets added to the template (for example class="component-banner-dark-birds"). In the future I would like to add the variable "colour_variants" so we don't have any double ups of variants. There is also another variable called "block_style_variants" which adds a different type of style variant to the template.