• Resolved pansotdev

    (@pansotdev)


    Hello,

    How can i output the link of the combined css and js?

    I see that if i clear the cache the url changes.

    /wp-content/uploads/siteground-optimizer-assets/siteground-optimizer-combined-js-40fe9e8646165c44e624cd1a9a2a4c22.js

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @pansotdev

    The URLs of the combined CSS/JS are changed if a change in any of the scripts that are combined occur.

    Each script/style represents an md5 hash of the script content, so if a single character is changed, the script/style name will be changed as well.

    Why do you need the script name?

    Regards,
    Stanimir

    Thread Starter pansotdev

    (@pansotdev)

    Hello,

    I am trying to print the link for preload like the following code.

    <link rel="preload" href="/wp-content/uploads/siteground-optimizer-assets/siteground-optimizer-combined-css-d6d056fe19791af9c7165011f1563856.css" as="style">

    Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    This is not something that you can safely do since there are no hooks designed there. We’re reworking this optimization and we will properly preload fonts. If you add your style this way, you will break your site since it will be missing the onload parameter. Generally, I would advice against preloading your CSS this way. There won’t be any change in the performance of your site doing so.

    Hello
    I am also trying to get the name of these scripts to add a http/2 push using

    function htt2push() {
    header(“Link: </wp-content/uploads/siteground-optimizer-assets/siteground-optimizer-combined-css-db2ff765783b43ff170db845f1a00e92.css>; rel=preload; as=style”, false);
    }
    add_action(‘wp_head’, ‘htt2push’, 0);

    However The combined CSS/JS filenames can’t be called via hook.
    Because Instead of hooks, buffers are used.
    add_action( ‘init’, array( $this, ‘start_bufffer’ ) );
    add_action( ‘shutdown’, array( $this, ‘end_buffer’ ) );

    SG told me that we can find the names of the combined CSS/JS files by using regular expressions in this buffer.

    But i never used buffer. Can somebody helps and share an example code?

    thanks

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

The topic ‘How to print the combined js and css?’ is closed to new replies.