-
Notifications
You must be signed in to change notification settings - Fork 3
Proposal to fix an underscore-engine issue: configurable output file suffixes #26
Comments
@geoffp - In general I'm fine with this. I think there's only one issue at the moment. System InputThe following options defined in the config:
System OutputFiles will be rendered with the appropriate suffixes.
BehaviorIf these options are not configured and therefore
Building pattern paths should set the "rendered" option so no need to be explicit on the front-end about it. ExampleA config with:
Will end up with files like:
And two tabs called HTML. If this is ok I can vote with a thumbs up. |
I am in favor of the proposal - making those filenames configurable makes sense. @dmolsen -
This issue has come up on two occasions now:
Does this setting only control the tab label? If so, could it be derived from the pattern's file itself? |
Argh. Considering To be clear, PL/PHP doesn't support a mixed "pattern tree." I don't really intend on going that route either. If your PatternEngine set-up allows it cool. Looking through your code it seems it does. My rules are a bit stricter than that and I only invoke one PatternEngine. When @geoffp chimes in on what I wrote up I'll vote. |
@dmolsen - I do think we should be able to change the title of the template tab based on each pattern's file extension, but in the Node case, the pattern engine loader is able to produce each engine's human-readable name (indirectly, via each Pattern object) based on the file extension, so I think in our case we'd prefer to use that value if that doesn't mess anything up for the PHP version. That way we wouldn't see HTML/HTML in the tabs, we'd see Underscore/HTML. Apart from that clarification, I agree with everything you posted! |
@geoffp - Ah, got it now. 👍 from me on this change and I'll move it up the queue. I have some fixes that need to happen to |
👍 cheers! |
My "panels" implementation/configuration needs to be revisited anyway. I'll put another proposal in for that. This works in the short-term. |
Thanks Dave - lemme know if ever you need help with the front end, I should really become more familiar with it anyways. |
Sorry, have to re-open this. The edited description of the solution based on feedback from @bmuenzenmeyer doesn't jive with what @geoffp said. @geoffp - So the underscore patterns are ending with |
@dmolsen - no, I think we had it right before. Our raw underscore templates end in .html, that's why they're overwriting the rendered version in the current scheme. And -- thanks for the quick analysis and triage! |
I'm probably just overthinking this... Please correct me if I'm wrong. So the original pattern that uses underscore would be something like:
Using the following rules:
and the fact that the file extension on the pattern is
This is because the edited version of my proposal said "The original file extension for the pattern will be added to rawTemplate option." We're sort of back to square one. So if we make the suffixes explicit to include the final file extension they would look like:
Then this would be the explicit output regardless of original pattern extension:
The original pattern extension could still be used for the tab. The original behavior I outlined above should still work appropriately. For PHP I'll use the existing behavior as a default in case those options are missing (e.g. Let me know how this might affect node. Still doable. I just want to get it right. |
Not quite. The original pattern that uses underscore has an extension of .html (which, admittedly, is quite a bummer), and looks like:
Currently, this results in this:
And that's the problem. The raw template version (the second file in that list) blows away the first one, since they wind up named the same. So, the idea is that if I provide this configuration:
I will instead wind up with a workable set of output files:
For a template engine like Handlebars with a more sensible file extension, it will still work fine:
Including the file extensions in the config assumes that all templates in a tree have the same extension, which is the case of Node is not necessarily true because we can have mixed pattern trees. |
Ok, clearly overthinking. Then back to my original proposal/implementation. I appreciate the clarification @geoffp . |
implementation tips:
I'll update if there are any other tips. I think this is implemented for PHP and FE but want to test some more. |
No worries. Thanks again! |
Feature configurable suffixes pattern-lab/the-spec#26
@geoffp can you test with
|
In pattern-lab/styleguidekit-assets-default#39 a user notes that there's an issue with |
I am also trying to ping that user back - as I think that code has now stabilized between PL/Node Core and SAD. |
As the maintainer of a design system that uses Underscore templates, I use Pattern Lab / Node to maintain it, and have written a pattern engine to be able to author Underscore templates. Unfortunately, our library of Underscore templates consists of files named with the
.html
extension. This destroys the frontend viewer's ability to render them, since the raw template overwrites the rendered output during the build step; they have exactly the same filename.Therefore, as per @dmolsen's suggestion, I propose that the naming of these output files be configurable. I propose, for simplicity, that this be done with the addition of configurable suffixes for these output files, which would appear at the end of the base file name but before the file extension. Here is a proposal for the configuration structure, with the present-day scheme as defaults:
The timeline for this feature is ASAP. This is blocking our migration to Pattern Lab 2.0.
If I had permissions to do so, I would tag this needs-implementation because no POC implementation yet exists.
/cc @pattern-lab/voting-members
The text was updated successfully, but these errors were encountered: