-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure lack of sections does not break styleguide and update examples #119
Ensure lack of sections does not break styleguide and update examples #119
Conversation
sections = [] | ||
} | ||
components = components ? processComponents(components) : []; | ||
sections = sections ? processSections(sections) : []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it will run twice?
Maybe:
if (sections) {
sections = processSections(sections);
components = components ? processComponents(components) : [];
}
else {
components = processComponents(components);
sections = sections ? processSections(sections) : [];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. I completely forgot to take line 44 and 45 out :)
Please also check Travis log. |
@sapegin The other option here is to move these to the |
else { | ||
components = processComponents(components); | ||
sections = []; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A trivial fix to this would be just:
components = processComponents(components);
sections = processSections(sections || []);
The intention was that you could use sections and components in parallel (if for some reason you wanted that).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s the best version I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't clear whether they could both be provided or not, if they can then this works fine. I went for the more verbose ifelse here just to make it clear what was happening. I'd be more than happy to clean it up like this though 👍
But how would you check for required sections or components? (Not sure it’s necessary.) And in you current implementation you can use only sections or components, not both. (No sure it’s critical or bad.) |
So to be clear here, my understanding is this:
That last point is something I am not clear on. I assume that they can both be provided, however if a section contains a component that is provided within the components configuration property, then that component will be listed twice within the style guide. Is this correct @sapegin and @paulj? |
@karlbright Yes. If the same files ended up being listed twice (either in components and sections, or even just in two different sections), then they would end up being included twice. |
@paulj Cool, figured as much. Updated to cleaner syntax, much happier. |
Thanks @karlbright @paulj! |
This fixes issues introduced by the merge of #108 in to master.
Both @paulj and @sapegin may have some ideas on the changes to
index.js
here, but this ensures that sections not being provided will not break the styleguide. There were issues with running examples as a result of this merge.This also adds a basic example using sections for testing this new feature.