Skip to content

Commit 6f73317

Browse files
committed
feat(syntax): add copy to clipboard button for every code snippet
Fix #574 Fix #525
1 parent 07595b3 commit 6f73317

File tree

7 files changed

+1283
-7
lines changed

7 files changed

+1283
-7
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
Title: Code Snippets -- Copy to Clipboard
3+
Tags: code-snippets, gist, unique
4+
Date: 2020-02-03 19:17
5+
comments: false
6+
Slug: code-snippets-copy-to-clipboard
7+
authors: Talha Mansoor
8+
Category: Components
9+
---
10+
11+
Elegant is the only Pelican theme that comes with a "Copy To Clipboard" button
12+
on every code snippet.
13+
14+
Try it out
15+
16+
```go
17+
fmt.Println("Hello Clipboard")
18+
```
19+
20+
We use excellent JavaScript library, [clipboard.js](https://clipboardjs.com/) for this feature. Your readers do not need Flash for this feature.

gulpfile.babel.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ const watchFiles = () => {
6565
"templates/**/*.html",
6666
"static/**/*.css",
6767
"static/**/*.less",
68-
"!static/**/elegant.prod.css",
6968
"static/**/*.js",
70-
"!static/js/elegant.prod.js",
7169
"!static/**/bootstrap.css",
72-
"!static/**/bootstrap_responsive.css"
70+
"!static/**/bootstrap_responsive.css",
71+
"!static/**/elegant.prod.css",
72+
"!static/js/elegant.prod.js"
7373
],
7474
{ ignoreInitial: false },
7575
buildAll
@@ -91,6 +91,8 @@ const minifyJS = () => {
9191
"static/photoswipe/photoswipe.js",
9292
"static/photoswipe/photoswipe-ui-default.js",
9393
"static/photoswipe/photoswipe-array-from-dom.js",
94+
"static/clipboard/clipboard.js",
95+
"static/js/copy-to-clipboard.js",
9496
"!static/js/elegant.prod.js"
9597
])
9698
.pipe(concat("elegant.prod.js"))

0 commit comments

Comments
 (0)