• Resolved mommygeekology

    (@mommygeekology)


    After processing the files, I’m seeing 4-5 minified css files ad a similar number of minified .js files appearing.

    How is the # of files determined?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Tyler Johnson

    (@tylerjohnsondesign)

    I’m not the plugin developer, but I believe that’s a normal operation because you have files being loaded in the footer and the header, as well as administration files when logged in, which also get minified.

    • This reply was modified 7 years, 9 months ago by Tyler Johnson.
    Plugin Author launchinteractive

    (@launchinteractive)

    Thats right Tyler. New files are also generated for different media types (ie. css print) as well as external files.

    You can sometimes re-order your enqueue code so that you have the smallest amount of files. This doesn’t always work as some plugins can mess it up.

    I also noticed less files being concatenated, without style order or number having changed on my site, and took a look as to why. MMR makes sure that styles with different media types don’t get concatenated into one (which is good because that could break the look of the site otherwise), but it doesn’t fall back to the default of ‘all’ for enqueued styles where no media type was given. This is easily fixed by some slight re-ordering of the code that does check the media type (diff against MMR 1.7.2):

    --- merge-minify-refresh.php	Tue Feb 28 03:16:28 2017
    +++ merge-minify-refresh.php	Tue Feb 28 13:59:55 2017
    @@ -682,8 +682,8 @@
     
     				if( $this->host_match($wp_styles->registered[$handle]->src) && !in_array($wp_styles->registered[$handle]->src, $this->ignore) && !isset($wp_styles->registered[$handle]->extra["conditional"])) { //is a local script
     
    -					if(!$this->mergecss || isset($footer[count($footer)-1]['handle']) || count($footer) == 0 || $footer[count($footer)-1]['media'] != $wp_styles->registered[$handle]->args ) {
    -						$media = isset($wp_styles->registered[$handle]->args) ? $wp_styles->registered[$handle]->args : 'all';
    +					$media = isset($wp_styles->registered[$handle]->args) ? $wp_styles->registered[$handle]->args : 'all';
    +					if(!$this->mergecss || isset($footer[count($footer)-1]['handle']) || count($footer) == 0 || $footer[count($footer)-1]['media'] != $media ) {
     
     						array_push($footer, array('modified'=>0,'handles'=>array(),'media'=>$media ));
     					}
    @@ -830,8 +830,8 @@
     
     				if( $this->host_match($wp_styles->registered[$handle]->src) && !in_array($wp_styles->registered[$handle]->src, $this->ignore) && !isset($wp_styles->registered[$handle]->extra["conditional"])) { //is a local script
     
    -					if(!$this->mergecss || isset($header[count($header)-1]['handle']) || count($header) == 0 || $header[count($header)-1]['media'] != $wp_styles->registered[$handle]->args ) {
    -						$media = isset($wp_styles->registered[$handle]->args) ? $wp_styles->registered[$handle]->args : 'all';
    +					$media = isset($wp_styles->registered[$handle]->args) ? $wp_styles->registered[$handle]->args : 'all';
    +					if(!$this->mergecss || isset($header[count($header)-1]['handle']) || count($header) == 0 || $header[count($header)-1]['media'] != $media ) {
     						array_push($header, array('modified'=>0,'handles'=>array(),'media'=>$media ));
     					}
     	
    
    Plugin Author launchinteractive

    (@launchinteractive)

    Thanks fhoech. I’ve just applied your patch to MMR 1.7.3

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘High number of minified files appearing’ is closed to new replies.