Open fabinol opened 7 years ago
@mrmachine @markfinger see above
The maban/styleguide
project has a nice example at http://codeforamerica.clearleft.com/
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.
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.
(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.
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.
Some frameworks worth considering when creating styleguides: http://trulia.github.io/hologram/ https://github.com/maban/styleguide https://github.com/kneath/kss