-
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
feat: Webp images with fallback #99
Open
meanmachin3
wants to merge
3
commits into
pythonindia:master
Choose a base branch
from
meanmachin3:feature/webp-images
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,17 +3,23 @@ | |
<div class="row"> | ||
<div class="col-md-3 text-center"> | ||
<ul class="list-inline"> | ||
<li><a target="_blank" href="https://www.facebook.com/PyConIndia/">{% asset fb.png alt="Facebook" %}</a></li> | ||
<li><a target="_blank" href="https://twitter.com/pyconindia">{% asset tw.png alt="Twitter" %}</a></li> | ||
<li><a target="_blank" href="https://www.facebook.com/PyConIndia/"> | ||
{% picture src=fb alt="Facebook"%} | ||
</a></li> | ||
<li><a target="_blank" href="https://twitter.com/pyconindia"> | ||
{% picture src=tw alt="Twitter"%} | ||
</a></li> | ||
</ul> | ||
<a target="_blank" href="mailto:[email protected]">[email protected]</a> | ||
</div> | ||
<div class="col-md-6 text-center"> | ||
{% asset logo-small.png alt="PyCon India 2019 Logo" width="70%" %} | ||
{% picture src=logo-small alt="Twitter" width="70%"%} | ||
</div> | ||
<div class="col-md-3 text-center"> | ||
<p class="design-by">Design by</p> | ||
<a target="_blank" href="http://webchirpy.com">{% asset wclogo.png alt="Webchirpy Logo" width="40%" %}</a> | ||
<a target="_blank" href="http://webchirpy.com"> | ||
{% picture src=wclogo alt="Webchirpy Logo" width="40%"%} | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Jekyll | ||
class RenderTimeTag < Liquid::Tag | ||
|
||
def initialize(tag_name, markup, tokens) | ||
super | ||
@args = Parser.new(markup) | ||
end | ||
|
||
def render(context) | ||
attributes = "" | ||
@args.each do |key, value| | ||
if key == :src | ||
attributes.concat("#{key}='./assets/images/#{value}.png'") | ||
else | ||
attributes.concat("#{key}='#{value}' "); | ||
end | ||
end | ||
tag = "<picture> | ||
<source srcset='./assets/images/#{@args[:src]}.webp' type='image/webp'> | ||
<img #{attributes}> | ||
</picture> | ||
" | ||
return tag | ||
end | ||
end | ||
end | ||
|
||
Liquid::Template.register_tag('picture', Jekyll::RenderTimeTag) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Rather than checking for each attribute like this, can we just loop over all attributes and add them here?
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.
@astronomersiva Can you check now ?
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.
this looks good...I believe the only issue now is with versioning the files(the checksum)?
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.
@astronomersiva Yes. Do you have any suggestions wrt versioning ?
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.
Can you try using the jekyll assets helper here? Let's try that out and see