-
AuthorPosts
-
January 5, 2023 at 6:20 pm #1377724
Hello,
i have problems with the layerslider layout when i set “CSS File Merging And Compression” to “enable” under Performance. How can I exclude that the layerslider.css is compressed? If I don’t “merge”, I have 74 css files more, absolutely not acceptable. So, how can I load layerslider.css normally and “merging” the rest?January 6, 2023 at 4:12 am #1377785Hey spee65,
Thank you for the inquiry.
You can add this filter in the functions.php file to exclude the layerslider.css file from the merged file.
function avia_exclude_files_from_compression($excluded_files){ $exclude_js = array( 'layerslider'); $excluded_files['js'] = array_merge($excluded_files['js'], $exclude_js); return $excluded_files; } add_filter('avf_exclude_assets', 'avia_exclude_files_from_compression', 10, 1);
Please make sure to toggle the Enfold > Performance > File Compression settings after adding the filter.
Best regards,
IsmaelJanuary 6, 2023 at 10:27 am #1377804This reply has been marked as private.January 6, 2023 at 10:44 am #1377807yes – and if you like to exclude the css files it works similar to the above filter:
function avia_exclude_files_from_compression($excluded_files){ // exclude css $exclude_css = array( 'layerslider', 'abc', 'xyz'); // comma separated list of enqueue names $excluded_files['css'] = array_merge($excluded_files['css'], $exclude_css); // exclude js files $exclude_js = array( 'avia_google_recaptcha_front_script', 'abc_script'); // comma separated list of enqueue names $excluded_files['js'] = array_merge($excluded_files['js'], $exclude_js); return $excluded_files; } add_filter('avf_exclude_assets', 'avia_exclude_files_from_compression', 10, 1);
it is mentioned as comment to insert the list of enqueued names ! – example given here is recaptcha script
the enqueue name is: avia_google_recaptcha_front_script
the script name is: avia_google_recaptcha_front ( with that in the list it won’t work ) : the script name is therefore not determinant hereJanuary 6, 2023 at 10:50 am #1377810This reply has been marked as private.January 6, 2023 at 10:52 am #1377811This reply has been marked as private.January 6, 2023 at 10:57 am #1377812edited the snippet above to clarify what to insert.
January 6, 2023 at 11:01 am #1377813This reply has been marked as private.January 6, 2023 at 11:03 am #1377814no private content for me – you had to wait then for mods
by the way – if you have jQuery set to load in the footer, then I’m not sure if excluding will also cause those files to be loaded in the footer.January 6, 2023 at 11:05 am #1377815This reply has been marked as private.January 6, 2023 at 11:06 am #1377816all fine, thanks for your help!
Best redgards
January 6, 2023 at 1:57 pm #1377858Hi,
Great, I’m glad that @guenni007 could help you out. Please let us know if you should need any further help on the topic, or if we can close it.
Best regards,
Rikard -
AuthorPosts
- You must be logged in to reply to this topic.