-
Notifications
You must be signed in to change notification settings - Fork 167
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
Remove octicons altogether from gollum-lib. #441
Conversation
Remove unnecessary precompilation task.
…con. Leave finding and rendering the actual icon to frontend (gollum).
In response to @benjaminwil in #440 about having to update two gems if we ever decide to change icon sets (or if octicons change their icon names), let me add the following. Right now, I've opted to use the same mechanism of setting If we want to avoid this altogether, we could choose to leave those hardcoded names out, and only supply a |
I didn't realize that the If it were up to me alone, I would change the macro method signatures to not take icons as arguments so we can further separate the presentational code in Using only CSS class names, we can indicate to <!-- `gollum-lib` note macro output-->
<div class="flash flash-note macro-note">
...
</div> /* `gollum`-provided CSS for the note macro. */
.flash.macro-note::before {
content: url('path-to-icon.svg');
width: 64px;
/* etc... */
} End users could still provide a custom icon using custom CSS without having to make any changes to pages using the macro: /* Custom CSS file. */
.flash.macro-note {
background-color: var(--custom-background-color);
}
.flash.macro-note::before {
content: url('path-to-custom-icon.svg');
} Alternatively, it would be nice if the macros could be moved to the All that said, I still like this change as-is and think it's an improvement for |
What about if we style / add icons in gollum's CSS for |
…comes without default icon.
I really like the idea of a flash macro that can have customizable styles. On the other hand, I could see an argument for providing a customizable macro templates every place we document custom Gollum macros, since we can't anticipate exactly how custom someone might want their flash message to be. |
I'm not entirely sure I follow. :) Is the point that providing one here (ie. Just to expand on my thinking, I'm operating with a dual aim here. On the one hand, I'm on board with having styling be done as much as possible in gollum. On the other hand, I want to keep it as straightforward as possible for people to add flash banners (with and without icons) to their pages. Preferably, this can be done without utilizing |
I was intending the former, but don't feel strongly at all. I don't think it's "overkill" but I am always a fan of maintaining less code. I think having a generic, style-able flash message would be great, just curious about what the benefits and tradeoffs are in terms of maintenance, and at what point we should push users to creating their own macros. |
Same here. 👍 I think in this case the code is straightforward and easy to maintain, and even simplified in comparison to what it was before. Of course, we'll get some more code in gollum in return to actually inject the icons. More generally, when it comes to macros, @dometto and I have been guided both by what other platforms offer and by specific use cases that users have brought to the fore. With use cases, we try to decide whether we see it as feature that would broadly benefit (non-technical, non-programmer) wiki users. If so, we offer it out of the box; otherwise we recommend creating a custom Macro. Does that make sense? |
It all makes sense to me! Thanks for your patience and for responding to all my comments. I really don't feel strongly about any of this, and support whatever decisions you choose to make! |
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.
Sorry to respond to this so late! I like this solution a lot, it's much cleaner than the octicon-entangled situation we had before. :)
Think I found a small issue in the line comments, and also I wonder if this should be merged in to master
(current target branch) or 6.x
, given that the required changes to CSS (?) in gollum
have not been made yet?
What issue are you referring to?
I guess |
I meant the unused optional parameter! |
@bartkamphorst looks like the JRuby test failure is trivial: nokogiri on JRuby outputs the attributes for the icon |
@@ -1,3 +1,8 @@ | |||
# 5.2.2 / 2023-01-18 |
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.
Just noticed there are some 'old' commits like this one in this PR. Does a git rebase 6.x
get rid of them?
Tests are passing, yay! |
* Remove octicons altogether from gollum-lib. * Rename Octicon macro to Icon. Leave finding and rendering the actual icon to frontend (gollum). * Remove hardcoded octicon names from gollum-lib. * Add Flash macro that comes without default icon. * Upgrade minitest-reporters.
This is an alternative to #440. This PR removes the octicon dependency entirely from gollum-lib. Instead of generating an icon svg in gollum-lib, the relevant macros instead output
divs
with up to three data-* attributes (data-gollum-icon
, and optionallydata-gollum-icon-height
anddata-gollum-icon-width
). The idea would be that gollum would subsequently use these data-attributes to look up the right icon (for the time being, octicon) and inject it into the DOM. This way, the octicon gem is only a dependency for gollum, and no longer for gollum-lib.This PR also renames the Octicon Macro to Icon.