sensei icon indicating copy to clipboard operation
sensei copied to clipboard

Only load Sensei assets when needed

Open AlecRust opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe

Sensei is adding a significant overhead to my pages. A number of Sensei assets load on every page of my site, but the courses are a small section of the site private to paid users.

Namely sensei-fontawesome.css is contributing almost 300ms to my Home page load time. Full path:

/wp-content/plugins/woothemes-sensei/plugins/sensei-pro/assets/dist/shared-module/sensei-fontawesome.css

Describe the solution you'd like

Only load the Sensei assets (JS and CSS) on pages that need it, such as:

  • My Courses
  • Course overview page
  • Lesson page
  • Module pages
  • Quiz pages

Describe alternatives you've considered

Installing some plugin which de-registers specific plugin assets from particular pages, which I'd rather not do.

AlecRust avatar Jun 16 '22 21:06 AlecRust

5550521-zen

aicee avatar Sep 14 '22 04:09 aicee

Support References

This comment is automatically generated. Please do not edit it.

  • [ ] 5550521-zen

github-actions[bot] avatar Sep 14 '22 04:09 github-actions[bot]

Now with the latest 4.7.0 release learning-mode.css is being loaded on every page of my site and interfering with my buttons, despite Learning Mode being switched off.

Edit: Guess I'll do this for now:

/**
 * Deregister Sensei's learning-mode.css which interfere's with our button styles
 */
function deregister_sensei_learning_mode_stylesheet()
{
  wp_deregister_style('sensei-learning-mode');
}
add_action('wp_enqueue_scripts', 'deregister_sensei_learning_mode_stylesheet', 20);

AlecRust avatar Oct 11 '22 12:10 AlecRust

Hey Alec!

learning-mode.css loading was due to a bug that's now fixed in 4.7.1.

The original issue with sensei-fontawesome.css is also fixed in the latest Sensei Pro release. Thanks for reporting these!

yscik avatar Oct 14 '22 13:10 yscik