Do you have a line break in your code? It fails for me when I copy-paste from here to my layout file, but if I delete the line break between '/vendor/foundation.min.js',
and '/vendor/audiolib.js'
then it compiles as expected.
Alternatively, you could also a string of .add()
commands like this:
<%- @getBlock('scripts').add('/vendor/foundation.min.js').add( '/vendor/audiolib.js').add('/vendor/freqfinder.js').add('/vendor/modernizr.js').toHTML() %>
That also comiples fine for me.
And a related note, in case anyone else comes across this error but doesn't have any line breaks: collection.add(null)
now causes the same error message. So, if you're doing something like this:
<%- @getBlock("scripts").add( @getDocument().get('scripts') ).toHTML() %>
It will die if you don't have a scripts
metadata field on every page.
The fix, however, is pretty simple:
<%- @getBlock("scripts").add( @getDocument().get('scripts') or [] ).toHTML() %>