• Resolved Doug

    (@nicoblog)


    Hello i wonder if you could make the plugin Only load CSS and JS files when needed?
    For example only on the pages where this is called:
    <?php do_action('show_beautiful_filters', 'posttypeslug'); ?>
    Thanks for reading.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Doug,

    I initially intended to do so but since I introduced the ability to put the action call where ever one wants (as well as the widgets) I can never determine when they are needed or not.

    Basically. When the do_action call above is made it’s too late to enqueue the css and js files and there is no way for BTF to know wether they exist in a template beforehand.

    So in short: No, it’s not possible.

    However they are pretty lightweight and if you implement some decent caching and maybe concatenate scripts and styles on your website their imprint as a whole is minimal!

    Thread Starter Doug

    (@nicoblog)

    Thanks i will merge all js into one to reduce calls. I’m not sure if minifying them is a good idea cos i think js easily breaks unlike css which is pretty safe to minify.

    Plugin Author Jonathandejong

    (@jonathandejong)

    No problem. Minifying is usually safe but sometimes one need to exclude some files that don’t agree to it. It’s usually when a developer has written poorly formatted JS..

    In the case of BTF all files that are served are already minified so no need to worry about those!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Only load CSS and JS files when needed?’ is closed to new replies.