ic-labs / django-icekit

GLAMkit is a next-generation Python CMS by the Interaction Consortium, designed especially for the cultural sector.
http://glamkit.com
MIT License
47 stars 11 forks source link

Best way to implement (modular) style guides? #43

Open fabinol opened 7 years ago

fabinol commented 7 years ago

Some frameworks worth considering when creating styleguides: http://trulia.github.io/hologram/ https://github.com/maban/styleguide https://github.com/kneath/kss

fabinol commented 7 years ago

@mrmachine @markfinger see above

markfinger commented 7 years ago

The maban/styleguide project has a nice example at http://codeforamerica.clearleft.com/

markfinger commented 7 years ago

So one of the primary benefits of this is enabling back-end devs to approach front-end coding with more confidence as there would be canonical examples of how to wire things up. Additionally, it enables front-end changes (styling, etc) to be made with a large suite of visual tests to sanity check against.

Primary issue I can see is how to wire this in with Django so that it's mostly automated. Without automation I fear that the examples would quickly drift and the styleguide would cease being useful.

markfinger commented 7 years ago

A possible alternative to an expansive style-guide is a page that lists all content types (pre-pop'd with data) + static components (collections of markup and styling).

Might be difficult to shoe-horn into a pre-existing project, but might be nice to test the water on a greenfield project.

cogat commented 7 years ago

(A pattern library is part of the ACMI project). My thoughts about this: At the moment, I think we own (or trivially could own) all the content plugins we use. Given that, I think it would be great to specify that each plugin defines a method that creates a sample version of itself, or perhaps several. This would be useful in several ways:

My other thought is that maybe the fluent renderer can look for a ?show_code GET parameter and render each content block twice - once in HTML as normal, and once as cleaned-up code in a pre tag, for copying/pasting.

mrmachine commented 7 years ago

We could write a custom DDF data fixture (http://django-dynamic-fixture.readthedocs.io/en/latest/data_fixtures.html) that knows how to populate various types of fields with nicer dummy content.

DDF is mostly concerned with simply creating a model that has all required fields populate with some valid data (correct type, unique when necessary, etc.) Which is fine for tests, but not ideal for generating sample content for styling and demo purposes.

For example, the custom data fixture might create related objects like content items that are not directly part of the model being instantiated and are not normally covered by DDF automatically.