Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wp-digital/wp-deferred-loading
Defer loading of stylesheets and JavaScript files.
https://github.com/wp-digital/wp-deferred-loading
Last synced: about 1 month ago
JSON representation
Defer loading of stylesheets and JavaScript files.
- Host: GitHub
- URL: https://github.com/wp-digital/wp-deferred-loading
- Owner: wp-digital
- Created: 2017-08-31T13:51:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-24T12:07:57.000Z (over 4 years ago)
- Last Synced: 2024-11-10T18:14:36.628Z (about 2 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 0
- Watchers: 14
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Deferred loading
### Description
WordPress plugin for deferred loading of JavaScript and CSS files.
### Install
Clone this repo to `wp-content/plugins/`:
````
cd wp-content/plugins/
git clone [email protected]:innocode-digital/wp-deferred-loading.git
````Activate **Deferred loading** from Plugins page
or [WP-CLI](https://make.wordpress.org/cli/handbook/): `wp plugin activate wp-deferred-loading`.Also you could install it as a [Must Use Plugin](https://codex.wordpress.org/Must_Use_Plugins).
### Usage
To defer JavaScript files, add to `functions.php` of theme:
````
add_filter( 'deferred_loading_scripts', function () {
return [
// List of enqueued scripts.
];
} );
````or
````
add_filter( 'deferred_loading_scripts', function () {
return '*'; // All enqueued scripts.
} );
````To defer CSS files, add to `functions.php` of theme:
````
add_filter( 'deferred_loading_styles', function () {
return [
// List of enqueued styles.
];
} );
````