I ran into some issues trying to embed source code that was outside of the jekyll root. Copying the files from their original location to src/_includes at build time was the only solution left after Googling for better solutions.

After trying to use webpack to do this, I decided to fall back on Ruby, and wrote a small Jekyll plugin to do it. It creates a hook on :after_init that copies files from the webpack source folder so I can include live versions of the source code used to build this site.

_plugins/copy_files.rb

require 'fileutils'

def copy_files(source, destination)
	puts %(copy_files.rb: Copying files from "#{source}" to "#{destination}")
	FileUtils.cp_r source, destination
end

Jekyll::Hooks.register :site, :after_init do |jekyll|
	copy_files 'webpack', 'src/_includes/code'
end