Closed lyzadanger closed 9 years ago
FWIW, as an MVP I think it would be perfectly acceptable to have to specify name
in front-matter to avoid 01-example
being output as 01 Example
. As long as we can override order and display a nicer name, I'm flexible as to how that occurs. (Obviously automatic things are nice, but I figured this would be helpful info in terms of prioritization.)
(One more thought: If we do pursue automatic ordering, some file path and URL confusion from our last client project suggests to me that an order
property in the YAML front-matter might be preferable to the filename prefix technique.)
I like what @tylersticka suggested about using a front-matter order
property.
@lyzadanger I wonder if we could simply transform the directory object/array just prior to (or during) template rendering (maybe even by using a template helper), rather than mess with it at the assembler level.
{{! src/views/layouts/includes/f-menu.html }}
{{#eachByKey materials "order"}}
<li>
<a href="{{@key}}.html" class="f-menu__heading">{{name}}</a>
<ul>
{{#each items}}
<li>
<a href="{{@../key}}.html#{{@key}}">{{name}}</a>
</li>
{{/each}}
</ul>
</li>
{{/eachByKey}}
Also, I see nothing wrong with transplanting fabricator-assemble and using a tweaked version instead of the current module.
@erikjung I don't see how we'd be able to do that kind of helper without providing it to fabricator-assemble
. It's that module that compiles that template :)
@erikjung Omigosh I'm a moron. You can hand off helpers to the assemble
task.
OK, then, if we can maintain the helper in the fabricator
forked source, I think I can move ahead on this. Cool.
This is sorted via #7
Hullo!
This is per the requirements around the ordering of patterns. Within the
fabricator
source itself, we have control over how to present the "top" level of navigation, primarily tweak-able within https://github.com/cloudfour/fabricator/blob/master/src/views/layouts/includes/f-menu.htmlHowever, the ordering of the individual patterns itself is a) currently based on file dir listing ordering and b) handled by
fabricator-assemble
, which is a separate module.The relevant areas of
fabricator-assemble
are within https://github.com/fbrctr/fabricator-assemble/blob/master/index.js , primarily lines 179-195 and 218-228-ish. To summarize:fs
file listingsTo contrast, our previous system was:
02-
) to make ordering explicitI can't immediately think of a way to get toward this requirement without making changes to
fabricator-assemble
source. One idea that had occurred to me was to alter the display names just within Handlebars/client-side (e.g. add another helper to transform the appearance of patterns in, say, the nav, but leave them alone on the filesystem). But I realized that helper would have to be in context forfabricator-assemble
to be able to compile correctly so again requires changes to that module.We could fork
fabricator-assemble
and update thepackage.json
dependencies to use our version, if we wanted. It's a bit squiggly. I'd love for @erikjung and/or @lharding to throw their brains at this, too, if any other inspirations surface...