-
Notifications
You must be signed in to change notification settings - Fork 27
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
Render WebmentionJSTag with a dedicated class #100
Render WebmentionJSTag with a dedicated class #100
Conversation
e183827
to
f406010
Compare
lib/jekyll/webmention_io.rb
Outdated
end | ||
end | ||
|
||
def self.gathered_templates |
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.
What do you think about renaming this html_templates
?
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.
I think html_templates
will do fine 😃
I like this approach. Thank you! I added two questions/comments. PS - I had not seen the ||= assignment pattern before. Using that with return is pretty clever! |
🙂 You're welcome. |
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.
Thank you.
This had a noticeable speed improvement. Thank you for making it happen! |
There was none at my end though.. (probably coz I'm on Windows....) |
Resolves #99
The rendered output of
WebmentionJSTag
is the same irrespective of givencontext
. So the content can be rendered once, cached elsewhere and then retrieved from the cache for each call to the tag's:render
method.(This PR also involves a micro-optimization by caching array of supported_templates in the main module itself, to avoid unnecessary allocations)