Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
Thanks for this fantastic module!! Is it possible to enable loadCSS only or certain pages? I do not want to use the "Inline CSS/JS on specific pages" because this will not load my actual styles.
I actually want to use the "Deferred CSS Execution: Use JS to load CSS" but only on specific pages because then I can actually combine that with critical-css that I already have in place.
Is there a way to achieve this?
Best regards
Joao Garin
Comment | File | Size | Author |
---|---|---|---|
#5 | advagg-2671148-6-per-page-loadCSS.patch | 5.71 KB | mikeytown2 |
#2 | advagg-loadCSS_specific_pages-2671148-2-7.patch | 1.74 KB | joaogarin |
Comments
Comment #2
joaogarin CreditAttribution: joaogarin commentedI am attaching a patch that ads this functionality.
Its quite simple and much like the already existing admin paths setting on the 7.x version. works as following :
1 ) In the settings page the user can provide the pages for enabling CSS deferring on specific pages. One per line in a textarea.
2 ) In the module file, if in the previous setting something was added (page paths) and the page does matches any of those pages, it just exists the page (return early).
if the user does not specify anything in this setting field it is just ignored and works as it already does.
The motivation behind this is that loadCSS requires you do something to get the above the fold CSS on the page (inline typically using something like criticalCSS). This is a task that is not so easily accomplished and sometimes it makes sense this is done for the most common entry points of the site such as landing pages, frontpage etc. But not for all pages of the site.
So this way you can have CSS defer on these pages, and the remaining pages just work as normal. This reduces the risk of using this setting since you can apply it on only one or two pages and actually see how they perform and gradually move to more pages.
Best regards
Joao Garin
Comment #3
joaogarin CreditAttribution: joaogarin at jobiqo - job board technology commentedChanging status of the issue.
Comment #4
joaogarin CreditAttribution: joaogarin at jobiqo - job board technology commentedComment #5
mikeytown2 CreditAttribution: mikeytown2 commentedHere's a modified version of your patch
Comment #7
mikeytown2 CreditAttribution: mikeytown2 commented#5 has been committed.
Comment #8
joaogarin CreditAttribution: joaogarin at jobiqo - job board technology commentedAwesome;) tks and congrats on a great module.
Comment #9
pdesai CreditAttribution: pdesai commentedNoticed a bug in advagg_mod.module:718 - missing "/src/" in the URL path: http://cdn.rawgit.com/filamentgroup/loadCSS/master/src/loadCSS.js
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commented@pdesai
The latest dev has that fixed.