https://github.com/fastruby/jekyll-images-cdn
A Jekyll plugin to replace relative image src with a CDN src
https://github.com/fastruby/jekyll-images-cdn
Last synced: 2 months ago
JSON representation
A Jekyll plugin to replace relative image src with a CDN src
- Host: GitHub
- URL: https://github.com/fastruby/jekyll-images-cdn
- Owner: fastruby
- License: mit
- Created: 2023-10-10T17:40:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-22T15:49:45.000Z (about 1 year ago)
- Last Synced: 2025-01-10T16:44:26.034Z (12 months ago)
- Language: Ruby
- Size: 4.88 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Jekyll Images CDN
This plugin adds replaces the `src` for images with a CDN url when the original URL is relative.
## Setup
1. Add the gem to your `Gemfile`:
```ruby
gem 'jekyll-images-cdn', github: 'fastruby/jekyll-images-cdn'
```
2. Run `bundle install` to install the gem
3. Add the following to your `_config.yml`:
```yaml
plugins:
- jekyll-images-cdn
```
## Usage
The plugin automatically edits all image and picture elements with relative paths for the src attribute prepending the defined CDN base url.
### Configuration
You can configure the plugin in the `_config.yml` file:
```yaml
images_cdn:
base_cdn_url: https:my_cdn.com
```
Or you can use the `ASSET_HOST` environment variable:
```
ASSET_HOST=https:my_cdn.com bundle exec jekyll build -d ../public/blog
```
> Note that, if both are defined, `ASSET_HOST` has priority