• Resolved Antony Booker

    (@antonynz)


    Thanks for this plugin.

    I noticed the CSS and JS files loaded from uploads/essential-addons-elementor/eael-templateid… contain a different version number (based on the date a post was modified) on each page, which forces the browser to redownload the files on each page view. The template file ID seems to be for the header and footer templates so the same script file name is loading on each page but with a different version.

    I’m assuming the get_post_modified_time() line was intending to be get_post_modified_time($dynamic_asset_id) ? in the enqueue_asset function.

    In this case the CSS and JS files are actually empty but a quick performance improvement could be to change the get_post_modified_time to set the version based of when the file was modified i.e changing:

    public function enqueue_asset( $post_id = null, $elements = [], $context = 'view' ) {
    $dynamic_asset_id = ( $post_id ? '-' . $post_id : '' );

    if ( $this->css_print_method == 'internal' ) {
    $this->css_strings .= $this->elements_manager->generate_strings( $elements, $context, 'css' );
    } else {
    if ( ! $this->has_asset( $post_id, 'css' ) ) {
    $this->elements_manager->generate_script( $post_id, $elements, $context, 'css' );
    }

    wp_enqueue_style(
    'eael' . $dynamic_asset_id,
    $this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.css' ),
    [ 'eael-general' ],
    get_post_modified_time()
    );
    }

    if ( $this->js_print_method == 'internal' ) {
    $this->custom_js .= $this->elements_manager->generate_strings( $elements, $context, 'js' );
    } else {
    if ( ! $this->has_asset( $post_id, 'js' ) ) {
    $this->elements_manager->generate_script( $post_id, $elements, $context, 'js' );
    }

    wp_enqueue_script(
    'eael' . $dynamic_asset_id,
    $this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.js' ),
    [ 'eael-general' ],
    get_post_modified_time(),
    true
    );

    to:

    public function enqueue_asset( $post_id = null, $elements = [], $context = 'view' ) {
    $dynamic_asset_id = ( $post_id ? '-' . $post_id : '' );

    if ( $this->css_print_method == 'internal' ) {
    $this->css_strings .= $this->elements_manager->generate_strings( $elements, $context, 'css' );
    } else {
    if ( ! $this->has_asset( $post_id, 'css' ) ) {
    $this->elements_manager->generate_script( $post_id, $elements, $context, 'css' );
    }

    wp_enqueue_style(
    'eael' . $dynamic_asset_id,
    $this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.css' ),
    [ 'eael-general' ],
    filemtime( EAEL_ASSET_PATH . '/' . 'eael' . $dynamic_asset_id . '.css' ),
    );
    }

    if ( $this->js_print_method == 'internal' ) {
    $this->custom_js .= $this->elements_manager->generate_strings( $elements, $context, 'js' );
    } else {
    if ( ! $this->has_asset( $post_id, 'js' ) ) {
    $this->elements_manager->generate_script( $post_id, $elements, $context, 'js' );
    }

    wp_enqueue_script(
    'eael' . $dynamic_asset_id,
    $this->safe_url( EAEL_ASSET_URL . '/' . 'eael' . $dynamic_asset_id . '.js' ),
    [ 'eael-general' ],
    filemtime( EAEL_ASSET_PATH . '/' . 'eael' . $dynamic_asset_id . '.js' ),
    true
    );
    }
    }

    Would it be possible to implement this performance tweak?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Sadman Sakib Nadvi

    (@sadmansakibnadvi)

    Hello @antonynz ,

    I hope you are doing well.

    Thank you for reaching out to us. I have informed our development team about your request, and they will evaluate its feasibility. Please allow us some time to investigate. I will get back to you as soon as I have an update from them.

    Thank you!

    Plugin Support Sadman Sakib Nadvi

    (@sadmansakibnadvi)

    Hello @antonynz ,

    Greetings!

    Thank you for your valuable suggestions. Our development team has reviewed the feasibility and will be working on implementing these improvements soon. We truly appreciate your feedback and will keep you updated on the progress.

    Thanks again for your input—it helps us enhance our plugin.

    Have a great day!

    Best regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.