WordPress.org

Ready to get started?Download WordPress

Forums

Better WordPress Minify
[Working version for WP3.6.x, and update Minify library to 2.1.7] (22 posts)

  1. JibsouX
    Member
    Posted 10 months ago #

    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

    http://wordpress.org/plugins/bwp-minify/

  2. JibsouX
    Member
    Posted 10 months ago #

    If it broke your site (style or animation javascript) simply test to exclude them with the plugin option

  3. sireneweb
    Member
    Posted 10 months ago #

    Great,
    you add some improvement, is it includes in library 2.1.7 ? or you add new function or code ?

  4. sireneweb
    Member
    Posted 10 months ago #

    yeas other idea as :
    - possibility to select order loading javascripts and css

  5. JibsouX
    Member
    Posted 10 months ago #

    I simply upgrade the library because of the mega-vulnerability

    I have make two improvement of functionalities :
    i have change the expire date of the cache files dirrectly in the code (and i working on a input in the setting page for user to modify it.)
    I have increased the level of compression of the cache gzip : 0 to 8

    I Simply fix the minification of : jquery-core and jquery-migrate
    with the fix of 'veke'

    hope it's good for u, me on 3 wordpress 3.6.1 it work well :)

    ---

    I propose some improvement to make for the next version like :
    - capabilitie to change the expire of the cache dirrectly in the admin page (in process)
    - capabilitie to Make script asynchrone
    - capabilitie to minify script from CDN
    - possibility to select order loading javascripts and css
    - ...

    Other idéas ?

  6. JibsouX
    Member
    Posted 10 months ago #

    If you Download and test it tell me if it work :-)
    - install
    - setting up
    - look in the dirrectory cache if there is some file
    - look in your source code if the url of your script are :
    http://my-site.com/wp-content/plugins/bwp-minify/min/?f=....(script)

    If it broke your site (style or animation javascript) simply test to exclude them with the plugin option

  7. sireneweb
    Member
    Posted 10 months ago #

    yes it works for me :) thanks a lot

  8. sireneweb
    Member
    Posted 10 months ago #

    For script asynchrone, you can find somes ideas with this plugin :
    http://wordpress.org/plugins/wp-deferred-javascripts/

  9. JibsouX
    Member
    Posted 10 months ago #

    Yes i know this plugin and the library it use but i dont know how change the path for the script to deferred, it alway deferred the wp_enqueue_scripts but the script of bwp minify are not implemented with wp_enqueue_scripts so there is many modification to make for add the asynchrone function ^^ i'm on it but i'm not sure to have enought skills..

  10. sireneweb
    Member
    Posted 10 months ago #

    me too ^^, but if i can help you to improve the component, tell me i'm avalaible to help you

  11. JibsouX
    Member
    Posted 10 months ago #

    the thing is to know how bwp minify include the new (combined file) and there simply insert the functionality of deferer

    the deferer function will replace the function that include the combined file in page that bwp minify has created

    so :

    1 : locate in the code where bwp minify include in the page (front) the combined file he have created

    2 : Know how it include

    3 : apply the way that bwp minify include the combined files to the deferer script.

    if it work : we can make a selection in the setting to choose if user want include combined files with no deferred or with it.

  12. sireneweb
    Member
    Posted 10 months ago #

    I found it but we need to add somes variables for 2 functions to enable the deferring.

    in fact, we need to create new footer custom field to select which scripts we want defer because we can't use for slider or slideshow ...

    function get_minify_tag
    -> create the style or scripts
    -> the array is generate by get_minify_src

    function print_footer_scripts
    -> include in footer

  13. JibsouX
    Member
    Posted 10 months ago #

    i think we have just a new hook to create like the already existing hook : http://betterwp.net/wordpress-plugins/bwp-minify/#advanced_customization

    but for this one do not add the deferring functionnalities :)

  14. Khang Minh
    Member
    Plugin Author

    Posted 10 months ago #

    It's great that you guys are working on the plugins also. In the next version I will put a Git repository up so we can collaborate there easily.

    I will review your version and release an update in the next week.

    Thanks a lot!

  15. sireneweb
    Member
    Posted 10 months ago #

    ah it's a good news, we believed you stop to work on your plugin :(

  16. JibsouX
    Member
    Posted 10 months ago #

    .. i cant found a way to include the deferer plugin in bwp minify if any one have a breakthrough ?

  17. JibsouX
    Member
    Posted 10 months ago #

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

    <script src="http://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("http://mysite.com/wp-includes/js/jquery/jquery.js?v=1.10.2").wait()
    .script("http://mysite.com/wp-includes/js/jquery/jquery-migrate.min.js?v=1.2.1").wait()
    .script("http://mysite.com/?v=1.10.2").wait()
    .script("http://mysite.com/wp-content/themes/js/plugins.min.js?v=3.6.1").wait()
    .script("http://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="http://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("http://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>
  18. JibsouX
    Member
    Posted 10 months ago #

    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://' : 'http://';
    		$path_and_deferring = apply_filters('bwp_get_minify_src', trailingslashit(str_replace(array('http://', '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="http://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>
    $LAB
    .script("http://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="http://mysite.com/wp-content/plugins/bwp-minify/includes/js_deferred/lab.min.js"></script>
    <script>$LAB.script("http://mysite.com/wp-content/plugins/bwp-minify/min/?f=").wait();</script>

    DAMMMM'N !

  19. mompracem
    Member
    Posted 10 months ago #

  20. JibsouX
    Member
    Posted 10 months ago #

    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://' : 'http://';
    						$path_and_deferring = apply_filters('bwp_get_minify_src', trailingslashit(str_replace(array('http://', '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');
    		}
    	}
  21. sireneweb
    Member
    Posted 10 months ago #

    For deffered javascript, did you use this ?
    http://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

  22. JibsouX
    Member
    Posted 10 months ago #

Reply

You must log in to post.

About this Plugin

About this Topic