• Hy there !

    I have a custom version of BWPminify that actually Work for WP3.6.x, and i have made the update for Minify library to 2.1.7 because of the OLD sérious vulnerability on all the old version of the library.

    [Download]
    Enjoy it !

    There is some improvement to make for the next version like :

    – capabilitie to change the expire of the cache dirrectly in the admin page
    – capabilitie to Make script asynchrone
    – …

    Other idéa ?

    Thanks for all // JibsouX

    https://www.ads-software.com/plugins/bwp-minify/

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter JibsouX

    (@jibsoux)

    I have add deferred capabilities but it deferring all script one by one like the normal capabilities of wp deferred plugin

    <script src="https://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("https://mysite.com/wp-includes/js/jquery/jquery.js?v=1.10.2").wait()
    .script("https://mysite.com/wp-includes/js/jquery/jquery-migrate.min.js?v=1.2.1").wait()
    .script("https://mysite.com/?v=1.10.2").wait()
    .script("https://mysite.com/wp-content/themes/js/plugins.min.js?v=3.6.1").wait()
    .script("https://mysite.com/wp-content/themes/my_theme/js/scripts.js?v=3.6.1");
    </script>

    now i want to not print one .js by one but deferring the output of bwp minify

    so how can i create a $variable to put in it the output of bwp minify ???

    to do that in result :

    <script src="https://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("https://mysite.com/wp-content/plugins/bwp-minify/min/?f=wp-includes/js/jquery/jquery.js,ppi/wp-includes/js/jquery/jquery-migrate.min.js,wp-content/themes/my_theme/js/plugins.min.js,wp-content/themes/my_theme/js/scripts.js).wait();
    </script>

    Thread Starter JibsouX

    (@jibsoux)

    I almost do it !!!

    // Print script tags
    		$scripts = ('header' == $action) ? $this->header_scripts : $this->footer_scripts;
    		foreach ($scripts as $script_array)
    		{
    			if (0 < sizeof($script_array))
    				echo $this->get_minify_tag(implode(',', $script_array), 'script');
    		}
    
    		// Deferring
    		echo '<script src="' . plugin_dir_url( __FILE__ ) . 'js_deferred/lab.min.js"></script>' . "\r\n";
    		$to_deferring = implode(',', $script_array);
    		$scheme_str = is_ssl() && !is_admin() ? 'https://' : 'https://';
    		$path_and_deferring = apply_filters('bwp_get_minify_src', trailingslashit(str_replace(array('https://', 'https://'), $scheme_str, $this->options['input_minurl'])) . '?f=' . $to_deferring, $this->options['input_minurl']);
    		$do_deferring .= '<script>'.'$LAB'.'.script("'.$path_and_deferring.'").wait();</script>';
    		echo $do_deferring;
    		// End of deferring
    
    		do_action('bwp_minify_after_' . $action . '_scripts');
    	}

    just one thing : the script is also loading in header lol !!!

    in footer it’s good :

    <script src="https://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("https://mysite.com/wp-content/plugins/bwp-minify/min/?f=wp-includes/js/jquery/jquery.js,ppi/wp-includes/js/jquery/jquery-migrate.min.js,wp-content/themes/my_theme/js/plugins.min.js,wp-content/themes/my_theme/js/scripts.js).wait();
    </script>

    in header : (to remove)

    <script src="https://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>$LAB.script("https://mysite.com/wp-content/plugins/bwp-minify/min/?f=").wait();</script>

    DAMMMM’N !

    Thread Starter JibsouX

    (@jibsoux)

    Ok Last problem solved and i have add deferring capabilities to the plugin it work but i haven’t test it with all the possibilities the the pluggin betterwpminify offer like all the different hook

    and i simply simulate a chackbox (activate deferred)
    $checkbox_for_deferring_capability=’cheked’;

    now i must create a checkbox in the setting panel with a save in bdd.

    function print_scripts($action = 'header')
    	{
    		do_action('bwp_minify_before_' . $action . '_scripts');
    
    		// Print script tags
    		$scripts = ('header' == $action) ? $this->header_scripts : $this->footer_scripts;
    		foreach ($scripts as $script_array)
    		{
    			if (0 < sizeof($script_array))
    			$checkbox_for_deferring_capability='cheked';
    				if(empty($checkbox_for_deferring_capability)){
    				 echo $this->get_minify_tag(implode(',', $script_array), 'script');
    				}
    				else {
    					// Deferring
    					echo '<script src="' . plugin_dir_url( __FILE__ ) . 'js_deferred/lab.min.js"></script>' . "\r\n";
    						$to_deferring = implode(',', $script_array);
    						$scheme_str = is_ssl() && !is_admin() ? 'https://' : 'https://';
    						$path_and_deferring = apply_filters('bwp_get_minify_src', trailingslashit(str_replace(array('https://', 'https://'), $scheme_str, $this->options['input_minurl'])) . '?f=' . $to_deferring, $this->options['input_minurl']);
    						$do_deferring .= '<script>'.'$LAB'.'.script("'.$path_and_deferring.'").wait();</script>';
    					echo $do_deferring;
    					// End of deferring
    				}
    		do_action('bwp_minify_after_' . $action . '_scripts');
    		}
    	}

    For deffered javascript, did you use this ?
    https://www.feedthebot.com/pagespeed/defer-loading-javascript.html

    https://developers.google.com/speed/docs/best-practices/payload?hl=it#DeferLoadingJS

    The problem with defered javascript is that you specify which javascript you want to defer because you can’t use for slideshow in fact for this example, you need to load in head

    Thread Starter JibsouX

    (@jibsoux)

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘[Working version for WP3.6.x, and update Minify library to 2.1.7]’ is closed to new replies.