Shopify render tag work strange? Need help

Bulxar
Explorer
68 1 12

Hi everyone,

 

When you put any {% render %} template tag inside HTML header tag  the ordering no matter.

 

Example: 

{% render '1-custom-script' %}   1-custom-script include only console.log(1);

And after it

 

 

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>

 

 

 

The output will be :

ALLL YOUR INSTALLED PLUGINS JS includes and in the end the console.log(1) scipt;

After that your stylesheet from above;;

 

So let's say you have 10 app's, the result will be;

1 <script type="text/javascript" async="" src="app1"></script>

2 <script type="text/javascript" async="" src="app2"></script>

3 <script type="text/javascript" async="" src="app3"></script>

4 <script type="text/javascript" async="" src="app4"></script>

5 <script type="text/javascript" async="" src="app5"></script>

6 <script type="text/javascript" async="" src="app6"></script>

7 <script type="text/javascript" async="" src="app7"></script>

8 <script type="text/javascript" async="" src="app8"></script>

9 <script type="text/javascript" async="" src="app9"></script>

10 <script type="text/javascript" async="" src="app10"></script>

+++++++++ Shopify Google Analytics, Facebook and other stuff included by default.

then console.log(1) and then your stylsheet.

WHY?

 

0 Likes
Bulxar
Explorer
68 1 12

Sorry, the render template include one of the store app's code.  Which is checking for mtafield in shop.

 

Also if you put any script tag at the top of the header the all shop app's script's are loaded

0 Likes