prestade Posted November 12, 2020 Share Posted November 12, 2020 Salut , Afin d'optimiser le temps de chargement du site , j'ai jouté aux différents ressources css et js Quote <link rel="preload"> comme suit : stylesheets.tpl {foreach $stylesheets.external as $stylesheet} <link rel="preload" href="{$stylesheet.uri}" as="style"> <link rel="stylesheet" href="{$stylesheet.uri}" media="{$stylesheet.media}"> {/foreach} {foreach $stylesheets.inline as $stylesheet} <style> {$stylesheet.content} </style> {/foreach} javascript.tpl {foreach $javascript.external as $js} <link rel="preload" href="{$js.uri}" as="script"> <script src="{$js.uri}" {$js.attribute}></script> {/foreach} {foreach $javascript.inline as $js} <script type="text/javascript"> {$js.content nofilter} </script> {/foreach} {if isset($vars) && $vars|@count} <script type="text/javascript"> {foreach from=$vars key=var_name item=var_value} var {$var_name} = {$var_value|json_encode nofilter}; {/foreach} </script> {/if} En desktop ça fonctionne mais pas en mobile . NB : les @media query sont dans un fichier custom.css . j'ai trouvé dans ce lien Preloading_content niveau section "Including media" l'utilisation de preload pour les images responsives . Comment pourrais-je l'exploiter pour les @media css ?? Une idée . Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now