Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter mpbrunelle

    (@mpbrunelle)

    Just to be clear : I want this code to be minified but it is not. I would like to know how to make FVM minify it.

    Plugin Author Raul P.

    (@alignak)

    Can you post the exact code you are using to enqueue it?
    Which hook are you attaching the script to?

    You should create a function and then enqueue that function to the appropriate hook.
    https://www.wpbeginner.com/wp-tutorials/how-to-properly-add-javascripts-and-styles-in-wordpress/

    Thread Starter mpbrunelle

    (@mpbrunelle)

    Here is the code :

    wp_register_script( ‘jquery-autocomplete’, themedir( false ) . ‘/js/jquery.autocomplete.min.js’, array(‘jquery’), ”, true );
    wp_enqueue_script( ‘jquery-autocomplete’ );

    Thanks

    Thread Starter mpbrunelle

    (@mpbrunelle)

    And also :
    // enqueue base scripts and styles
    add_action(‘wp_enqueue_scripts’, ‘sq_scripts_and_styles’, 999);

    All the scripts are added through function.php. Strangely, autocomplete is the only one that is not minified even though it is concatenated.

    Plugin Author Raul P.

    (@alignak)

    It’s because of the extension being min.js

    When you add min.js to the file, it assumes it’s already minified and simply merges it.
    You cannot double minify scripts as it can break functionality, so if you want it to be minified, simply rename the file and adjust your code not to include the .min. part.

    I some script is onot being concatenated, then please add it to a function.
    Something like this:

    function wpb_adding_scripts() {
     
    wp_register_script('my_amazing_script', plugins_url('amazing_script.js', __FILE__), array('jquery'),'1.1', true);
     
    wp_enqueue_script('my_amazing_script');
    }
      
    add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' ); 
    Thread Starter mpbrunelle

    (@mpbrunelle)

    Thank you.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘jQuery Autocomplete is concatenated but not minified’ is closed to new replies.