MinQueue icon indicating copy to clipboard operation
MinQueue copied to clipboard

URL to combined CSS / JS changes, creates issue with static page caching

Open khromov opened this issue 10 years ago • 2 comments

For some reason, sometimes MinQueue decides to regenerate all the combined files. Since it doesn't clear the page cache in conjunction to this, CSS / JS is now broken, because the cached template still has references to the old MinQueue combiner URL:s. I've tried multiple cache plugins and it's always the same issue.

I guess the root issue is, what could possibly trigger MinQueue to randomly rewrite the files.

khromov avatar Oct 02 '14 23:10 khromov

Bump on this. I haven't experienced it, yet, but we use Akamai for a lot of our sites. I'd hate for the cached version, even if just for a few minutes before it refreshes, to be looking for a file that doesn't exist. This plugin seems freaking incredible as I've been testing it locally & would be great to use in our team of folks that may not feel comfortable setting up something like Node/Grunt/Gulp/etc.

donaldG avatar May 18 '15 18:05 donaldG

After checking out the Better WP Minify plugin, perhaps a resolution for this would be allowing 'pretty' names for the files, or something similar. I tend to like this plugin a bit more than BWP Minify just because there are less options/distractions. Perhaps something as simple as 'minqueue' w/o the hash. Then maybe each subsequent js/css minqueued file could just be 'minqueue-1', 'minqueue-2', etc.

Maybe something like:

    private function get_group_handle( $group ) {

    if ( empty( $this->group_handles[$group] ) ) {

        $data = array();
        $i = 0;
        foreach( $this->process_queue[$group] as $handle ) {

            $data[$handle] = array( 'version' => $this->class->registered[$handle]->ver );

            $file_path = $this->site_root .  $this->get_asset_path( $handle );
            if ( $this->checks_last_modified && file_exists( $file_path ) )
                $data[$handle]['modified'] = filemtime( $file_path );
        $i++;
        }
            $this->group_handles[$group] = $this->prefix.'-'.$i;

    }

    return $this->group_handles[$group];

}

I'm guessing the purpose of the hash is to give as much info as possible about when the files were created? Maybe there's a way to still include that info without it being dynamically placed into the name. I dunno, just thinking aloud here!

donaldG avatar May 18 '15 19:05 donaldG