I am building a Handlebars partial template to load a list of scripts that will be concatenated by useref. I would like to customize the list on individual pages using an inline block. I can get the name of the js-output to register, and the first js-input, but the list of js-inputs only renders the first item.

I've tried various {{#each}} configurations, both in the template and within the inline script, but no success.

Here's what I have so far – it's working except for the custom list of js-inputs.

The partial template:

{{!-- includes/js02.hbs --}}
<!--build:js assets/js/{{js-output}}.js -->
<script src="assets/js/{{js-input}}.js"></script>
<!-- endbuild -->

On the Page: The inline block modifier:

 {{!-- Customize page JS before concatenation. --}}
   {{#*inline "js02-block"}}
    {{> includes/js02
      js-output="minor.min"
      js-input="c"
      js-input="a"
      js-input="b"
    }}
  {{/inline}}

The code renders like this:

<!--build:js assets/js/minor.min.js -->
<script src="assets/js/c.js"></script>
<!-- endbuild -->

I want to see:

    <!--build:js assets/js/minor.min.js -->
    <script src="assets/js/c.js"></script>
    <script src="assets/js/a.js"></script>
    <script src="assets/js/b.js"></script>
    <!-- endbuild -->

etc.

. . . and I want to customize the list on the page template.

0 Answers