This code help to use clipboardsjs in code snippets generated from Jekyll, adding a button to copy code.
Add copy.js, clipboard.js and style.css into assets folder.
In Jekyll layouts files include modifications highlight style (I just add style for button created):
<link rel="stylesheet" href="/assets/style.css">
In the same files include clipboard.js and copy.js:
<script src="/assets/clipboard.min.js"></script>
<script src="/assets/copy.js"></script>
This example.html show the usage.