
Security News
libxml2 Maintainer Ends Embargoed Vulnerability Reports, Citing Unsustainable Burden
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
This gem is not supported anymore. If you want similar functionality please use jekyll-imagemagick.
If you just need plain webp conversion, without imagemagick resizing or filters go to the original version jekyll-webp.
WebP Image Generator for Jekyll Sites can automatically generate WebP images for all images on your static site and serve them when possible.
Read more about this tool on my blog at blog.sverrirs.com
gem install jekyll-webp
The release includes all necessary files to run, including the WebP redistributable executable files.
Currently the release includes the v0.5.1 version of the WebP utilities for Windows, Linux and Mac OS X 10.9 (Mountain Lion). Other versions and releases can be downloaded directly from the Google page.
Add the gem to your Gemfile
and to Jekyll's _config.yml
then run jekyll serve
again and you should see the generator run during site generation.
The plugin can be configured in the site's _config.yml
file by including the webp
configuration element
############################################################
# Site configuration for the WebP Generator Plugin
# The values here represent the defaults if nothing is set
webp:
enabled: true
# The quality of the webp conversion 0 to 100 (where 100 is least lossy)
quality: 75
# List of directories containing images to optimize, nested directories will not be checked
# By default the generator will search for a folder called `/img` under the site root and process all jpg, png and tiff image files found there.
img_dir: ["/img"]
# add ".gif" to the format list to generate webp for animated gifs as well
formats: [".jpeg", ".jpg", ".png", ".tiff"]
# File extensions for animated gif files
gifs: [".gif"]
# Set to true to always regenerate existing webp files
regenerate: false
# Local path to the WebP utilities to use (relative or absolute)
# Omit or leave as nil to use the utilities shipped with the gem, override only to use your local install
webp_path: nil
# List of files or directories to exclude
# e.g. custom or hand generated webp conversion files
exclude: []
############################################################
In case you don't have control over your webserver then using the <picture>
element and specifying all image formats available is the best option. This way the browser will decide which format to use based on its own capabilities.
<picture>
<source srcset="/path/to/image.webp" type="image/webp">
<img src="/path/to/image.jpg" alt="">
</picture>
If you can then configuring your webserver to serve your new .webp files to clients that support the format is probably the least problematic approach. This way you don't need to make any changes to your HTML files as your webserver will automatically serve WebP images when the client supports them.
Below is an example for a .htaccess configuration section in an Apache web-server. It will redirect users to webp images whenever possible.
####################
# Attempt to redirect images to WebP if one exists
# and the client supports the file format
####################
# check if browser accepts webp
RewriteCond %{HTTP_ACCEPT} image/webp
# check if file is jpg or png
RewriteCond %{REQUEST_FILENAME} (.*)\.(jpe?g|png)$
# check if corresponding webp file exists image.png -> image.webp
RewriteCond %1\.webp -f
# serve up webp instead
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
AddType image/webp .webp
Depending on other configurations in your
.htaccess
file you might have to update yourExpiresByType
,ExpiresDefault
andHeader set Cache-Control
directives to include the webp format as well.
FAQs
Unknown package
We found that jekyll-webp-resize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Libxml2’s solo maintainer drops embargoed security fixes, highlighting the burden on unpaid volunteers who keep critical open source software secure.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.