Skip to content

Commit

Permalink
Add async attribute to script tag
Browse files Browse the repository at this point in the history
  • Loading branch information
kudoh committed Feb 17, 2022
1 parent 820177a commit 23ae649
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function initClipboardJS(options) {
throw minified.error;
}
return `<script>${minified.code}</script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@${options.clipboardJSVersion}/dist/clipboard.js"></script>`;
<script async src="https://cdn.jsdelivr.net/npm/clipboard@${options.clipboardJSVersion}/dist/clipboard.js">${minified.code}</script>`;
}

module.exports = {
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

exports[`clipboard.js initialization custom plugin config 1`] = `
"<script>function showTooltip(o,e){o.trigger.className.includes(\\"tooltipped\\")||(o.trigger.children[0].className=\\"tooltipped tooltipped-s\\",o.trigger.children[0].ariaLabel=e)}window.onload=()=>{const o=new ClipboardJS(\\".test-button\\");o.on(\\"success\\",o=>showTooltip(o,\\"Success!!\\")),o.on(\\"error\\",o=>showTooltip(o,\\"Failure!!\\"))};</script>
<script src=\\"https://cdn.jsdelivr.net/npm/clipboard@2.0.0/dist/clipboard.js\\"></script>"
<script async src=\\"https://cdn.jsdelivr.net/npm/clipboard@2.0.0/dist/clipboard.js\\">function showTooltip(o,e){o.trigger.className.includes(\\"tooltipped\\")||(o.trigger.children[0].className=\\"tooltipped tooltipped-s\\",o.trigger.children[0].ariaLabel=e)}window.onload=()=>{const o=new ClipboardJS(\\".test-button\\");o.on(\\"success\\",o=>showTooltip(o,\\"Success!!\\")),o.on(\\"error\\",o=>showTooltip(o,\\"Failure!!\\"))};</script>"
`;
exports[`clipboard.js initialization default plugin config 1`] = `
"<script>function showTooltip(o,e){o.trigger.className.includes(\\"tooltipped\\")||(o.trigger.children[0].className=\\"tooltipped tooltipped-s\\",o.trigger.children[0].ariaLabel=e)}window.onload=()=>{const o=new ClipboardJS(\\".code-copy\\");o.on(\\"success\\",o=>showTooltip(o,\\"Copied!\\")),o.on(\\"error\\",o=>showTooltip(o,\\"Failed...\\"))};</script>
<script src=\\"https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.js\\"></script>"
<script async src=\\"https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.js\\">function showTooltip(o,e){o.trigger.className.includes(\\"tooltipped\\")||(o.trigger.children[0].className=\\"tooltipped tooltipped-s\\",o.trigger.children[0].ariaLabel=e)}window.onload=()=>{const o=new ClipboardJS(\\".code-copy\\");o.on(\\"success\\",o=>showTooltip(o,\\"Copied!\\")),o.on(\\"error\\",o=>showTooltip(o,\\"Failed...\\"))};</script>"
`;
exports[`custom renderer custom renderer config 1`] = `
Expand Down

0 comments on commit 23ae649

Please sign in to comment.