Queuing JS created in a theme file

I have a theme file that I am listing posts in and pulling associated image links that I want to backstretch into related Div’s.

If Jquery and Backstretch were in the head this would be no problem as I could create (ugly) js scripts through my file, or append them to create one.

But with the /new way/ I really should generate the JS and get it into the footer belowJquery and the bower-fied backstretch script.

How best to do this from a theme file?

What I’ve done for now is append to a JS array in the theme file and output at the bottom of it. And then foreach’ed that array in _main.js and launched the Backstretch action.

Probably not perfect as the JS array is within the tags, but … oh well …

If anybody has any better ideas would love to hear them :slight_smile:

What JS are you trying to generate?

@netm check out wp_localize_script().