Skip to content

js/bundle-blog.js #31

Answered by kdevo
a0damasco asked this question in Q&A
Mar 24, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @a0damasco,

It's correct as is.

{{- else -}}
{{ $scripts := slice (resources.Get "js/src/base.js") (resources.Get "js/src/nav.js") }}
{{ $content := ($scripts | resources.Concat "js/bundle-blog.js" | js.Build $buildOptions).Content }}
<script>{{ $content | safeJS }}</script>

This file is bundling all blog-relates JS files to a bundle-blog.js file.

The $scripts | resources.Concat "js/bundle-blog.js" means "take all $scripts and concat them to a file named js/bundle-blog.js.

Doc reference: https://gohugo.io/hugo-pipes/bundling/

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@a0damasco
Comment options

@kdevo
Comment options

Answer selected by a0damasco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants