finnlesueurgmailcom - 1 week ago

Hey all,

I want to use the asset_inline() Twig command to inline all the scripts contained inside the asset_scripts() collection but can't quite figure out the syntax.

In the docs they give the following syntax to loop through all the scripts in the collection:

{% for script in asset_scripts("scripts.js") %}
    {{ script|raw }}
{% endfor %}

but I'm not sure how I'd work with this for inlining.

Could anyone provide any hints?

ryanthompson - 1 week ago

Try using asset_urls in the loop and then asset_inline(url)

Otherwise I can make something for ya :-)

finnlesueurgmailcom - 1 week ago

That didn't quite seem to work @ryanthompson - I'd be super stoked if you could whip something up! I'm all about minimising those HTTP requests ;)

ryanthompson - 1 week ago

Can you whip up a feature request issue? I'll get on it tonight or tomorrow.

finnlesueurgmailcom - 1 week ago

I would but I'm not sure how! All I can see on the Git for the streams-platform is pull requests and I don't have a fork to do the comparison with so I can't open anything

ryanthompson - 1 week ago

Ill write something in shortly (tonight) and ping you.

ryanthompson - 1 week ago

Have you tried just {{ asset_inline("scripts.js") }}? Don't ask me why I didn't think of that before :-P But that should suffice.