Support » Plugin: PhastPress » Question about “Minify scripts and improve caching”

  • If I turn on “Minify scripts and improve caching”, what does it actually do?

    Do it combine scripts and minimize it to one file?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Albert Peschar

    (@kiboit)

    Hi @hz_i3,

    Yes, all scripts are combined into a single request. Also inline scripts are minified.

    Are you having any trouble using this functionality?

    –Albert

    Thread Starter hz_i3

    (@hz_i3)

    Hi Albert, thanks for the reply. I just wanted to know what it does.

    Does “Minify scripts and improve caching” generate 2 minified scripts, one in header, one in footer? Or it just generates one JS file and place it in header?

    I am asking because some scripts are required to be put in header as they are supposed to be render blocking. But others can be put in the footer, before the end of <body>.

    Plugin Author Albert Peschar

    (@kiboit)

    Hey @hz_i3,

    It’s a little more complicated than that. PhastPress doesn’t just combine the scripts into one file and put them in the header or footer. It leaves the script tag in the right place, and uses an AJAX request to request the contents of the scripts in one request. The scripts are then executed in the order that they appear in the document.

    Scripts will never be render blocking either. Even if they occur at the top of the page, they will be executed after the page has rendered. So it doesn’t matter where you put the script (header or footer), they will never block page load.

    If you must have a script executed before rendering, use the data-phast-no-defer attribute (see the FAQ). It is almost never necessary, though.

    –Albert

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.