diff --git a/hugo.yml b/hugo.yml index cf0e7529e..314fb0a94 100644 --- a/hugo.yml +++ b/hugo.yml @@ -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" diff --git a/package-lock.json b/package-lock.json index ff8bb4296..fa3050902 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "@justinribeiro/lite-youtube": "^1.5.0", "autoprefixer": "^10.4.19", "bootstrap": "^5.3.3", "clipboard": "^2.0.11", @@ -18,6 +17,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", @@ -426,12 +426,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/@justinribeiro/lite-youtube": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@justinribeiro/lite-youtube/-/lite-youtube-1.5.0.tgz", - "integrity": "sha512-TU92RKtz9BI9PRYrVwDIUsnFadLZtqRKWl1ZOdbxb7roJDb8Dd/xURllAsLEmCg6oJNyhXlVa5RsnUc0EKd8Cw==", - "dev": true - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2907,6 +2901,12 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/lite-youtube-embed": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/lite-youtube-embed/-/lite-youtube-embed-0.3.2.tgz", + "integrity": "sha512-b1dgKyF4PHhinonmr3PB172Nj0qQgA/7DE9EmeIXHR1ksnFEC2olWjNJyJGdsN2cleKHRjjsmrziKlwXtPlmLQ==", + "dev": true + }, "node_modules/load-json-file": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-7.0.1.tgz", diff --git a/package.json b/package.json index 76ffa39de..172e11892 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/assets/js/lite-youtube.js b/src/assets/js/lite-youtube.js index e6d709f1e..9c81ff297 100644 --- a/src/assets/js/lite-youtube.js +++ b/src/assets/js/lite-youtube.js @@ -1 +1 @@ -import '@justinribeiro/lite-youtube' +import 'lite-youtube-embed' diff --git a/src/layouts/_default/home.html b/src/layouts/_default/home.html index 2fd72160f..997d664bb 100644 --- a/src/layouts/_default/home.html +++ b/src/layouts/_default/home.html @@ -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 -}} diff --git a/src/layouts/partials/stylesheet.html b/src/layouts/partials/stylesheet.html index 4f4805f03..d9778a6cc 100644 --- a/src/layouts/partials/stylesheet.html +++ b/src/layouts/partials/stylesheet.html @@ -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"> diff --git a/src/layouts/partials/video.html b/src/layouts/partials/video.html index c013dbced..51dacb1f5 100644 --- a/src/layouts/partials/video.html +++ b/src/layouts/partials/video.html @@ -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>