cloudfour / fabricator

A tool for building website UI toolkits
http://fbrctr.github.io/
1 stars 0 forks source link

Helper to provide display names for patterns #7

Closed lyzadanger closed 9 years ago

lyzadanger commented 9 years ago

This PR introduces a new Handlebars helper that can allow us to do custom ordering of patterns the way we did on VSE.

You can now name patterns prefixed with ddd- for ordering, e.g. 01-hi.html and they will display in the nav menu with prettier names. The helper displayName is available to any fabricator template now.

tylersticka commented 9 years ago

Neat! (I'm not reviewing, just commenting.)

erikjung commented 9 years ago

:+1:

This PR looks good to me, as this would be a useful helper. That said, I'm slightly confused about the overall necessity for it and how it relates to https://github.com/cloudfour/fabricator/issues/3

It seemed like the strategy for custom ordering was going to be implementing a front-matter order property to sort on (possibly with a template helper to sort the array based on that key).

Are we instead going to rely on file naming? That's fine if the first option seems overly difficult, just trying to make sure I didn't miss something here.

lyzadanger commented 9 years ago

items are already sorted when they get to the template layer. That order happens to be filesystem ordering. I thought it would be a lot easier to do it this way than try to implement an ordering mechanism. The ordering will always be correct, and we only need to make the display name nice in the places where it gets rendered. It also allows for ordering by filename, which I think is easier than maintaining the values of order in front matter across a bunch of files.