Why won't js assets combine / load with PyroCMS in production?

398 views Asked by At
{{ asset:js file="theme::custom.js" group="default" }}
{{ asset:js file="theme::app.js" group="default" }}

{{ asset:render_js group="default" }}
{{ asset:render_js group="modules" }}

That's my code for my JavaScript, but when I load in production, it doesn't load the script tag. However, in system/cms/config/asset.php if I turn asset_min and asset_combine to false, then it loads the JS files individually, without combining or minifying.

But I want it to combine and minify.

Help?

2

There are 2 answers

0
Khalil TABBAL On BEST ANSWER

You have to do has follow to render the JS assets :

{{ asset:js file="theme::custom.js" group="default" }} {{ asset:js file="theme::app.js" group="default" }}

{{ asset:render group="default" }} {{ asset:render group="modules" }}

I think asset:render_js don't actually works

0
atwright147 On

I have been having a similar problem.

It turns out {{ asset:render_js }} doesn't work, however <?php Asset::render_js(); ?> does.

So, for anyone else having problems in PyroCMS 2.2 using render_js, try the following:

{{ asset:js file="theme::javascript_file.js" }}
<?php Asset::render_js(); ?>