WP Manifestindependent plugin directory
manifest / performance / wee-conditional-loader

wee Conditional Loader GitLab

A conditional CSS and JavaScript loader for WordPress

★ 0stars
11composer installs

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitLab with WP-CLI:

wp plugin install https://gitlab.com/walterebert/wee-conditional-loader/-/archive/master/wee-conditional-loader-master.zip

On Packagist as wee/conditional-loader:

composer require wee/conditional-loader
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
wee Conditional Loader A conditional CSS and JavaScript loader for WordPress. It can be used to load files only if a certain CSS class or ID is present on a page. It uses Filament Group's loadCSS and loadJS. Warning: Execution order of requested scripts is not managed, so you should not use it to load multiple javascript files that depend on one another. JavaScript files will be loaded when the DOM is ready. Because of this, your scripts should not contain: - document.addEventListener( 'DOMContentLoaded', callback ); - window.onload - jQuery(document).ready(...) Example of loading JavaScript for a plugin only if the plugin CSS class is present: Example of loading CSS for a plugin only if the plugin ID is present: Of course you can also use it in themes: The JavaScript for this plugin is loaded inline by default and as external files if you are running HTTP/2.0. You can explicitly tell WordPress to use external files by setting the following constant in wp-config.php: This plugin can also be used to load CSS files asynchronously: Author Walter Ebert License MIT