• Resolved pnaw10

    (@pnaw10)


    Recently redid my site and I am frustrated that GTMetrix pagespeed test will give me nothing better than a C or D.

    I know there are other issues to fix (particularly with images needing to be resized), but several of the “render blocking resources” GTMetrix was blaming were linked to this plugin.

    Even though I am only displaying spreadsheets on one page of my entire website, it looks like all the javascript and other “overhead” stuff gets loaded on every page, no matter what. I know the plugin author isn’t watching this thread and seems to be resigned to providing further updates, so I am not even going to try asking for the plugin to be updated so it only appears on pages where it is needed.

    Instead, used the functions.php guidance the plugin author provided on the plugin repository to figure out how to disable most of this overhead fluff (my tables don’t need to be sorted, paginated, have buttons, printing, etc.).

    But GTMetrix still shows 2 references to URLs that include pdfmake in them. I eliminated those functions, and they don’t even appear in the page’s source code anymore. I’m puzzled as to how GTMetrix is still “seeing” them being downloaded, when they don’t appear in the source code.

    Any thoughts? This is just pestering me because I was excited to eliminate 90% of the bloat and even I can see the page loading faster… but I just want to eliminate these last 2 items. Thanks!

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter pnaw10

    (@pnaw10)

    I figured it out myself, and I will offer my solution in case anyone else has the same issue. In your functions.php, add these lines:

    function igsv_dequeue_google_charts_script ($scripts) {
        unset($scripts['jquery-datatables, datatables-buttons, datatables-buttons-colvis, datatables-buttons-print, pdfmake, pdfmake-fonts, jszip, datatables-buttons-html5, datatables-select, datatables-fixedheader, datatables-fixedcolumns, datatables-responsive, igsv-datatables, google-ajax-api, igsv-gvizcharts']);
        return $scripts;
    }
    function igsv_dequeue_google_charts_style ($styles) {
        unset($styles['jquery-datatables, datatables-buttons, datatables-select, datatables-fixedheader, datatables-fixedcolumns, datatables-responsive']);
        return $styles;
    }
    add_filter('gdoc_enqueued_front_end_scripts', 'gdoc_enqueued_front_end_styles', 'igsv_dequeue_google_charts_script',  'igsv_dequeue_google_charts_style')

    At first, I had only killed the scripts. I was hesitant to kill all of the styles as well, because I wasn’t sure if that would impact the one page on my website where I am showing a spreadsheet. But I tried anyway. Bingo. No impact on the spreadsheet page, and it finally stopped loading pdfmake. My GTMetrix grade immediately changed from C to A.

    PS – In my case, I am using Oxygen Builder, which bypasses the entire WordPress theme structure, so there is no functions.php. But I was able to create a custom plugin to execute the above code.

Viewing 1 replies (of 1 total)
  • The topic ‘PDFmake won’t go away’ is closed to new replies.