Hello
I’m trying to bundle a bunch of smaller javascript files to one combined file, using the method specified here.
But i was wondering, that instead of having each file as a single variable, as it can be cumbersome to maintain in a growing platform. So what i tried to do, was make an array of the paths to the files, and then i would like to range over that array to create that part resources.Get "path"
dynamically.
In my config.toml
i have this array:
[params.js]
node = [
'jquery/dist/jquery.min.js',
'jquery-validation/dist/jquery.validate.min.js'
]
project = [
'generic/global.js',
'generic/parallax.js',
'generic/format.js',
'generic/intro.js',
'navigation/smooth-scroll.js',
'navigation/sticky-nav.js',
'gallery/modal.js',
'contact/google-maps.js',
'contact/validation.js',
'contact/send-mail.js'
]
And this is what i tried, but without luck in my layout file _scripts.html
{{ $scripts := slice range .Site.Params.js.project resources.Get . end | resources.Concat "dist/scripts.min.js" | resources.Minify }}
<script type="text/javascript" src="{{ $scripts.Permalink }}"></script>
I get the following error when doing a range like that: unexpected <range> in operand
Kind regards,
Dennis