Jekyll Replace Image
Projects | | Links: Source
A Jekyll plugin to replace img tags with custom elements during site generation.
A Jekyll plugin to replace
img tags with custom elements during site generation.
What it does
It runs a regular expression to find HTML
img tags against the output of each page and replaces matches with a user-defined replacement.
There are a number of custom elements you can use, such as
amp-img and (my very own)
Note that replacing images during site generation is necessary for lazy-loading, because the browser will start loading any
img tag as soon as it is parsed, before it can be touched by client side code.
- Lazy-loading images increases page load speed and is recommended by Google.
- So you can use the
![alt](src)syntax for images without polluting your posts with lengthy HTML tags.