• Resolved craftbilt

    (@craftbilt)


    Hi there,
    When the “Combine JavaScript Files” option is activated on the SG optimizer, the PDF embedder plugin is not functioning and throwing the error below.
    I have added the following code to functions.php to exclude it, but still getting the error.
    Right now, the “Combine JavaScript Files” is not active, and the PDF is working on the following URL.

    https://craft-bilt.com/catalogue/

    PS. Even when I use the “excluding URL” option, still gives the same error.
    Did I miss anything during the implementation?
    Please let me know. Thanks

    Error:
    “Setting up fake worker failed: “Cannot load script at: https://craft-bilt.com/wp-content/uploads/siteground-optimizer-assets/siteground-optimizer-combined-js-cb937f7701612535bf71c597ee663506.worker.js”.”

    **********************************************************************************************************

    add_filter( ‘sgo_javascript_combine_exclude’, ‘js_combine_exclude’ );
    function js_combine_exclude( $exclude_list ) {
    $exclude_list[] = ‘pdfemb_embed_pdf_js and pdfemb_pdf_js’;

    return $exclude_list;
    }

    add_filter( ‘sgo_js_minify_exclude’, ‘js_minify_exclude’ );
    function js_minify_exclude( $exclude_list ) {
    $exclude_list[] = ‘pdfemb_embed_pdf_js and pdfemb_pdf_js’;

    return $exclude_list;
    }

    add_filter( ‘sgo_css_combine_exclude’, ‘css_combine_exclude’ );
    function css_combine_exclude( $exclude_list ) {
    // Add the style handle to exclude list.
    $exclude_list[] = ‘pdfemb_embed_pdf_css’;

    return $exclude_list;
    }

    add_filter( ‘sgo_css_minify_exclude’, ‘css_minify_exclude’ );
    function css_minify_exclude( $exclude_list ) {
    // Add the style handle to exclude list.
    $exclude_list[] = ‘pdfemb_embed_pdf_css’;

    return $exclude_list;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stoyan Georgiev

    (@stoyangeorgiev)

    Hello there @craftbilt,

    You excluded from the combination incorrect. You just have to make a new line for every script you wish to exclude. You can use this one, it will solve the issue.

    Simply change the first to filters like this

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
    	$exclude_list[] = 'pdfemb_embed_pdf_js';
    	$exclude_list[] = 'pdfemb_pdf_js';
    
    	return $exclude_list;
    }
    
    add_filter( 'sgo_js_minify_exclude', 'js_minify_exclude' );
    function js_minify_exclude( $exclude_list ) {
    	$exclude_list[] = 'pdfemb_embed_pdf_js';
    	$exclude_list[] = 'pdfemb_pdf_js';
    
    	return $exclude_list;
    }

    After that enable the JS Combination and everything should be working as expected.
    If you have any issues feel free to reach back to us.

    Kind regards,
    Stoyan

    Thread Starter craftbilt

    (@craftbilt)

    Thanks. It worked. I didn’t see “and” 🙂

    Thank you! Worked for me too 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Combine JavaScript Files conflicts with PDF Embedder’ is closed to new replies.