Conditionally enqueue styles and scripts

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Feature Request Conditionally enqueue styles and scripts

Viewing 1 reply thread
  • Author
    Posts
    • #60661
      jan
      Participant

      Hey,

      Not all of my pages, for example the front page or blog pages, are using WCFM/WooCommerce functions. Nevertheless, every page loads a whole bunch of JS and CSS from WCFM that is never used. Actually, even admin related stuff seems to load for non-logged-in-users on the frontend (wcfm_admin_bar_css). This is dragging down the loading times, first contentful paint and speed index of the according pages by more than a second. It also negatively influences the site speed score (SEO relevant).

      I went ahead and dequeued all of your styles and scripts for pages that don’t use any WCFM functionality for sure, but I really think it should be part of your plugins to only conditionally enqueue scripts and styles when they are necessary. I don’t want to keep track of every article, site or page template to exclude your JS and CSS from manually and it’s also not a good solution to first enqueue and then dequeue 19 (!!) files:
      Styles: ‘wcfm_wc_icon_css’, ‘wcfm_fa_icon_css’, ‘wcfm_admin_bar_css’, ‘wcfm_core_css’, ‘wcfmu_core_css’, ‘wcfmmp_store_list_css’, ‘wcfmmp_store_css’, ‘wcfm-frontend’, ‘wcfm_subscribe_button_css’, ‘wcfm_qtip_css’, ‘wcfm_colorbox_css’, ‘jquery-style’
      Scripts: ‘jquery-ui-datepicker’, ‘wcfm_membership_subscribe_js’, ‘wcfm_qtip_js’, ‘jquery-blockui_js’, ‘wcfm_colorbox_js’, ‘wcfm_core_js’, ‘wcfmu_core_js’

      Please consider this, I think it will have performance benefits for nearly every site using your plugin.

      Kind regards and keep it up! 🙂

    • #60775
      WCFM Forum
      Member

      Hi,

      Nevertheless, every page loads a whole bunch of JS and CSS from WCFM that is never used.

      – Not at all, it loads only core js and css in all pages. These are require for short code support.

      Still we will look into this.

      Thank You

Viewing 1 reply thread
  • The topic ‘Conditionally enqueue styles and scripts’ is closed to new replies.