Skip to content

Commit

Permalink
init plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
reatlat committed May 27, 2022
1 parent d15297f commit bc44316
Show file tree
Hide file tree
Showing 9 changed files with 5,698 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const isUrl = require('is-url');

module.exports = (eleventyConfig, options = {}) => {

const defaultOptions = {
mainScript: true,
class: 'vidyard-player-embed',
version: 4,
type: 'inline'
}

const globalOptions = { ...defaultOptions, ...options };

eleventyConfig.addShortcode("vidyard", (videoURL, options = {}) => {
if (!videoURL) {
throw new Error(
"[eleventy-plugin-vidyard] the videoURL must be specified"
);
}

if (!isUrl(videoURL) || !videoURL.match('vidyard.com\/watch\/')) {
throw new Error(
`[eleventy-plugin-vidyard] the videoURL "${videoURL}" is not valid url`
);
}

options = { ...globalOptions, ...options };

const UUID = videoURL.split('vidyard.com/watch/')[1].split('?')[0];

let $return = '';

if ( options.mainScript )
$return += '<script src="https://play.vidyard.com/embed/v4.js" type="text/javascript" async></script>';

$return += `
<img style="max-width: 100%;"
class="${options.class}"
src="https://play.vidyard.com/${UUID}.jpg"
data-uuid="${UUID}"
data-v="${options.version}"
data-type="${options.type}" />
`;

return $return;
});
};
3 changes: 3 additions & 0 deletions .eleventyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# To avoid using raw blocks
README.md
LICENSE
33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Eleventy Site Output
_site

# node modules
node_modules

# npm rc
.npmrc

# DS Store
.DS_STORE

# IDE
.idea
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 11ty site output
demo/
_site/
# misc
.eleventyignore
.idea
.github/
5 changes: 5 additions & 0 deletions demo/.eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const eleventyPluginVidyard = require("../.eleventy.js");

module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(eleventyPluginVidyard, {});
};
47 changes: 47 additions & 0 deletions demo/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---

---
<!DOCTYPE html>
<html lang="en">
<head>
<title>11ty Plugin Feather Icons - Demo</title>
<link rel="stylesheet"
href="https://unpkg.com/[email protected]/build/pure-min.css"
integrity="sha384-yHIFVG6ClnONEA5yB5DJXfW2/KC173DIQrYoZMEtBvGzmf0PKiGyNEqe9N6BNDBH"
crossorigin="anonymous">
<style>
body {
background: #fafafa;
}
.page-wrapper {
background: #fff;
max-width: 900px;
margin: 0 auto;
padding: 30px;
box-shadow: 0 5px 20px rgba(0,0,0,.15);
}
</style>
</head>
<body>
<div class="page page-wrapper">

<div class="content-wrapper">
<div class="content">
<div class="pure-g">
<div class="pure-u-1-1">
<h1>Vidyard Demo Video</h1>
<p>The Vidyard embed code helps embed Vidyard players into web pages and applications. It provides programmatic playback control, the ability to listen on playback events, GDPR consent control and integration with third party MAP platforms.</p>
</div>

<div class="pure-u-1-1">

{% vidyard "https://share.vidyard.com/watch/Cse5Fqy1CpUWqYdtikKrFy?embeded=true" %}

</div>
</div>
</div>
</div>

</div>
</body>
</html>
Loading

0 comments on commit bc44316

Please sign in to comment.