module Jekyll
Jekyll::Hooks.register :site, :post_write do |site|
build = site.config["destination"]
site.posts.each {|post|
source = post.path.split("/")[0..-2].join("/")
# SKIP POSTS THAT ARE SINGLE FILES NOT DIRECTORIES
if source.split("/")[-1] == "_posts"
next
end
destination = post.url.split("/")[0..-2].join("/")
# MOVE EACH ITEM IN DIRECTORY INTO BUILD
Dir.entries(source).each {|item|
if not [".","..",".DS_Store"].include?(item)
src = source+"/"+item
des = build+destination+"/"+item
FileUtils.copy_entry(src, des)
end
}
}
end
end