Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

CSS/JS pipeline, no asynchronous loading?

Started by Muut Archive 10 years ago · 2 replies · 596 views
10 years ago

Hi,

Just came across the following and was wondering if someone else faced this before.

I Pipelined all my CSS and JS, which works fine.

Now the problem is that the final 'pipelined' version of the CSS/JS is not loaded asynchronous.

I've tried changing the following:

TWIG
{{ assets.js('head',{'loading':'async'}) }}
-```

which results in the following:

<script src="/grav/assets/7e4dbcc0dd299bc8ab7c8091bab68bd4.js?g-15c57228" type="text/javascript" loading="async" ></script>

TXT


which in it's turn does not actually load the script asynchronous as far as i can judge. 

Is there a way to load the final 'pipelined' CSS/JS asynchronous?
10 years ago

There is currently a bug that I just fixed with: https://github.com/getgrav/grav/commit/12ca443cb4ed8b45cbbb2c01f6c7c883bb0c38f6

This will be available in Grav 1.1.0-beta.3 release. However, you can get it working with this workaround:

TWIG
{{ assets.js('head',{0:'async'}) }}

This will output:

HTML
<script src="/grav/assets/7e4dbcc0dd299bc8ab7c8091bab68bd4.js?g-15c57228" type="text/javascript" async="async" ></script>

Which should work fine. Or you can manually merge the fix into your running version of Grav.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1361 9 years ago
Archive · by Muut Archive, 9 years ago
2 939 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2958 9 years ago
Archive · by Muut Archive, 9 years ago
3 1123 9 years ago