Skip to content

Commit

Permalink
lite-youtube-embed
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Apr 1, 2024
1 parent 6bf4b4f commit 50fea86
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 17 deletions.
2 changes: 2 additions & 0 deletions hugo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ module:
target: assets/scss/bootstrap
- source: node_modules/bootstrap/dist/js/bootstrap.bundle.min.js
target: assets/js/vendor/bootstrap.bundle.min.js
- source: node_modules/lite-youtube-embed/src/lite-yt-embed.css
target: assets/css/lite-yt-embed.css

params:
docs_version: "5.3"
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"netlify": "cross-env-shell HUGO_BASEURL=$DEPLOY_PRIME_URL npm run build"
},
"devDependencies": {
"@justinribeiro/lite-youtube": "^1.5.0",
"autoprefixer": "^10.4.19",
"bootstrap": "^5.3.3",
"clipboard": "^2.0.11",
Expand All @@ -43,6 +42,7 @@
"find-unused-sass-variables": "^5.0.0",
"hugo-bin": "^0.121.1",
"linkinator": "^6.0.4",
"lite-youtube-embed": "^0.3.2",
"lockfile-lint": "^4.13.2",
"markdownlint-cli2": "^0.12.1",
"npm-run-all2": "^6.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/js/lite-youtube.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@justinribeiro/lite-youtube'
import 'lite-youtube-embed'
2 changes: 1 addition & 1 deletion src/layouts/_default/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1 class="post-title fw-semibold">
{{ partial "author-info" (dict "context" . "lazyload" $lazyload) -}}

{{ if .Page.Params.video -}}
{{- partial "video" (dict "context" . "lazyload" $lazyload) -}}
{{- partial "video" (dict "context" .) -}}
{{- end }}

{{ if .Page.Params.banner -}}
Expand Down
9 changes: 7 additions & 2 deletions src/layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}

{{- $style := resources.Get "scss/style.scss" | toCSS $sassOptions | postCSS $postcssOptions | fingerprint }}
<link href="{{ $style.RelPermalink }}" rel="stylesheet">
{{- $style := resources.Get "scss/style.scss" | toCSS $sassOptions -}}
{{- $lye := resources.Get "css/lite-yt-embed.css" -}}
{{- if hugo.IsProduction -}}
{{- $lye = $lye | minify -}}
{{- end -}}
{{- $styles := slice $style $lye | resources.Concat "/assets/css/styles.css" | postCSS $postcssOptions | fingerprint }}
<link href="{{ $styles.RelPermalink }}" rel="stylesheet">
7 changes: 2 additions & 5 deletions src/layouts/partials/video.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{{- /* Accepts 2 parameters, the "context" and "lazyload" */ -}}
{{- /* Accepts 2 parameters, the "context" and "video_start" */ -}}

{{- $lazyload := .lazyload -}}
{{- $video := .context.Params.video -}}
{{- $videoStart := .context.Params.video_start -}}

<div class="ratio ratio-16x9">
<lite-youtube videoid="{{ $video }}" videoStartAt="{{ $videoStart }}" nocookie="true" params="rel=0"{{ if eq $lazyload true }} posterloading="lazy"{{ end }}>
<a class="lite-youtube-fallback" href="https://www.youtube-nocookie.com/watch?v={{ $video }}" rel="noopener" target="_blank">Watch on YouTube"</a>
</lite-youtube>
<lite-youtube videoid="{{ $video }}" videoStartAt="{{ $videoStart }}" playlabel="Play video" params="rel=0"></lite-youtube>
</div>

0 comments on commit 50fea86

Please sign in to comment.