Skip to content

Commit

Permalink
feat(syntax): add copy to clipboard button for every code snippet
Browse files Browse the repository at this point in the history
Fix #574
Fix #525
  • Loading branch information
talha131 committed Feb 3, 2020
1 parent 07595b3 commit 6f73317
Show file tree
Hide file tree
Showing 7 changed files with 1,283 additions and 7 deletions.
20 changes: 20 additions & 0 deletions documentation/content/Components/code-copy-to-clipboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
Title: Code Snippets -- Copy to Clipboard
Tags: code-snippets, gist, unique
Date: 2020-02-03 19:17
comments: false
Slug: code-snippets-copy-to-clipboard
authors: Talha Mansoor
Category: Components
---

Elegant is the only Pelican theme that comes with a "Copy To Clipboard" button
on every code snippet.

Try it out

```go
fmt.Println("Hello Clipboard")
```

We use excellent JavaScript library, [clipboard.js](https://clipboardjs.com/) for this feature. Your readers do not need Flash for this feature.
8 changes: 5 additions & 3 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ const watchFiles = () => {
"templates/**/*.html",
"static/**/*.css",
"static/**/*.less",
"!static/**/elegant.prod.css",
"static/**/*.js",
"!static/js/elegant.prod.js",
"!static/**/bootstrap.css",
"!static/**/bootstrap_responsive.css"
"!static/**/bootstrap_responsive.css",
"!static/**/elegant.prod.css",
"!static/js/elegant.prod.js"
],
{ ignoreInitial: false },
buildAll
Expand All @@ -91,6 +91,8 @@ const minifyJS = () => {
"static/photoswipe/photoswipe.js",
"static/photoswipe/photoswipe-ui-default.js",
"static/photoswipe/photoswipe-array-from-dom.js",
"static/clipboard/clipboard.js",
"static/js/copy-to-clipboard.js",
"!static/js/elegant.prod.js"
])
.pipe(concat("elegant.prod.js"))
Expand Down
Loading

0 comments on commit 6f73317

Please sign in to comment.