I am trying to use pipes to bundle my plugins and script modules.
This is my code so far.
{{ $jsBundle := slice }}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/google-map/map.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/jquery/jquery.min.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/lazy-load/lozad.min.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/magnific-popup/jquery.magnific-popup.min.js" }}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/shuffle/shuffle.min.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "plugins/slick/slick.min.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "js/script.js"}}
{{ $jsBundle = $jsBundle | append resources.Get "js/pricing/boosting.js" }}
{{ $jsBundle = $jsBundle | append resources.Get "js/pricing/coaching.js" }}
{{ $jsBundle = $jsBundle | append resources.Get "js/pricing/placements.js" }}
{{ $jsBundle = $jsBundle | append resources.Get "js/pricing/tourneyTitle.js" }}
-->
{{ $jsBundle := $jsBundle | resources.Concat "js/bundle.js" | fingerprint "sha384" }}
<script src="{{ $jsBundle.Permalink | absURL }}"></script>
Whenever I run this code I get this error,
executing "partials/footer.html" at <resources>: wrong number of args for Get: want 1 got 0
So after trying to figure out how to fix this and trying to use filepath insteadof Get to use it I decided to go back to the way the tutorial i first watched did it. That link is here. Using Hugo Pipes to Bundle Scripts - YouTube You can skip to 17:00 to see where he gets the same exact error and then fixes it. The fix didnt work for me though.
{{ $jsBundle := slice }}
{{ range .Site.Params.plugins.js}}
{{ $jsFile := resources.Get .link | minify }}
{{ $jsBundle := $jsBundle | append $jsFile }}
{{ end }}
{{ $jsBundle := $jsBundle | resources.Concat "js/bundle.js" | fingerprint "sha384" }}
<script src="{{ $jsBundle.Permalink | absURL }}"></script>
When I try it this way instead the error message i get is
executing "partials/footer.html" at <resources.Concat>: error calling Concat: slice []interface {} not supported in concat
I can link the repo if neede. but rn it is not pushed fully. I would prefer to use the first way I listed that way i dont have to have multiple ranges for the plugins and the modules, and it lets me easily select what I want to use instead of auto everything.