Jekyll: Using CloudFront as a CDN
We decided to use Amazon CloudFront as a CDN to deliver media assets of our site. This seemed easy enough until we looked into how Jekyll-Bootstrap is written. For all intents and purposes, Jekyll-Bootstrap uses safe mode to indicate production. Though that would mean that none of our plugins would be used when deploying.
Amazon CloudFront is a web service for content delivery. It integrates with other Amazon Web Services to give developers and businesses an easy way to distribute content to end users with low latency, high data transfer speeds, and no commitments.
Time to modify jekyll itself.
Open up jekyll/bin/jekyll and add this new option:
opts.on("--[no-]production", "Production mode (default development)") do |production| options['production'] = production end
After modifying this, and feeling a bit bad about it, we went on to change Jekyll-Bootstrap as well.
We changed our configuration to include
Finally we added the following task to our Rakefile:
Now we can deploy to our production site and have it use the proper CloudFront URLs.