WP Scripts & Styles Optimizer

Description

Optimization of included JavaScript- and CSS-files can be a very important thing, if you want a faster site. Many WordPress plugins comes with multiple third-party and/or own JavaScript-files that are then often be included on every page of your site. In worst cases you have more than one of the same file included on your site. That slows down your site!

But also “Render blocking” can easily slow down a website. Every external JavaScript- or CSS-file, that is included in the head of your site, blocks the site from rendering, until all files are completely processed. It’s a common practice to move all these Scripts and Styles (except critical CSS) to the footer of your site, so the rendering is no longer blocked and your website loads faster.

This is where WP Script Optimizer helps you! It makes it possible to control the output of every registered JavaScript or CSS-file. You can easily create rules for it or deactivate files completely. You can also move files to the footer of your site or vice versa.

Check out the following lists for all currently avaiable and planned features. If you like this plugin, please upvote and comment. That would be really helpful.

What you can currently do with WP Script Optimizer

  • Get an overview of all frontend JavaScript and CSS files, that are included on your site (divided in categories)
  • Control scripts and styles for as many single pages as you want or simply globally
  • Change the positioning (Header/Footer) of specific JavaScripts / CSS or all at once
  • Deactivate specific Javascripts or CSS-files completely, if not needed
  • Easily create logical rules to control under which conditions a file is included or not (by use of wordpress’s conditional tags)

What you can do in future with WP Script Optimizer (planned, but not currently implemented)

  • Minify and/or encrypt JavaScript- and CSS-files
  • Include your own JavaScript/CSS files or JavaScript/CSS inline code, without do it manually through functions.php
  • Add extra code to any registered JavaScript or CSS-file
  • Concatenate two or more (or all) files of one type (JS or CSS) to speed up loading times
  • Better overview of dependents and its dependencys
  • … feel free to make suggestions 🙂

IMPORTANT – Please read:

This plugin can not decide if a file is needed or not needed in a specific situation. Your settings have the potential to break features and functions of your site. If that is the case, you can easily change or delete your settings via the admin panel, so everything will be like it was before.

tl;dr: you have to know what you’re doing 😉

If You had any problems with this plugin, please contact me, so i could fix it. Please don’t write a negative review without gave me the chance to correct any issues. Thanks.

Screenshots

  • Overview of global scripts and styles.
  • Overview of single page scripts and styles.
  • Avaiable Options for each file.
  • Set Conditions for any file.
  • Get scripts & styles for a single page.
  • Admin notices keeps you informed of what happened.

Installation

  1. Upload the plugin folder to the /wp-content/plugins/ directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the ‘Plugins’ screen in WordPress.
  3. Move onto the ‘WP Script Optimizer’ page in admin panel and click on ‘Update lists’ in the upper right corner.
  4. Thats it! Now you can start customize your scripts and styles.

FAQ

Coming soon…

Reviews

Plugin review for WP Scripts & Styles Optimizer

I rate this plugin 5-stars because of the ability to manage the loading and the relative positioning of the load for each script and style used on your WordPress website. Initially the interface may be confusing to some since the documentation is minimal and not very detailed. But with some time and experimentation the average user can figure out the real power and effectiveness of this plugin to streamline the loading of every page on his/her website. I hope this plugin continues to be supported by the author and that the features are enhanced as well.

How to set scripts for the Homepage

Hi,

first let me begin with it is a very helpful plugin, congratulatuion.

The only think I do not get to work is, how can I set my changes for the Homepage? I type in my www.domain.com/homepage an the page is found but the changes doesn’t save. On all other sites it works like a charm.

Und da Sven Lennartz sich hier für das Plugin stark macht und Hendrick auch ziemlich deutsch klingt möchte ich es auch nochmal auf unserer Landessprache kundtun @Hendrick einfach nur genial, bleibe bitte dran ist mega sinnvoll das plugin!

@Sven Lennartz über Sie/Dich brauche wir kein Wort zu verlieren, mit Peer gehörst du zum meinen absoluten lieblingsblogs. Danke für diese tolle Arbeit die du leistest!

This is it

So I’m not crazy; a plugin that does this actually exists. wow, this is an extremely important plugin and works good. Kinda makes you feel like a god, truly in control of all scripts and styles, whether, when and where they come in. Cool man. I would give you 6 stars if they had those. Big up!

Useless

So, after some days with this plugin, I can’t recommend this plugin anymore.
When I remove all filters that I had set, delete all caches and another plugin still has problems. But when I deactivate “WP Scripts & Styles Optimizer” and the other plugin works now, then something is wrong with “WP Scripts & Styles Optimizer”.

And I had problems with another plugin too.

After every plugin update or new installation or deletion you have to refresh the “WP Scripts & Styles Optimizer”-list. No idea why, since:

And there are more uncomfortable things in the workflow. When I delete a plugin, the JS and CSS files of this plugin are grayed out in “WP Scripts & Styles Optimizer”. It says “Can’t find the file”. And I can’t click on the checkboxes to delete all together, I have to remove it item for item. Why these files are still in the plugin-list of “WP Scripts & Styles Optimizer”, if they do not exist anymore? Also if I refresh the list, they are still there.

Btw. I changed the rating from 5 to 1 star, but it still shows 5 (atm).

Very usefull

In the past i had to disable the scripts by hand in the functions. Now its more comfortable 🙂

Read all 7 reviews

Contributors & Developers

“WP Scripts & Styles Optimizer” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

0.4.2

  • FIX: Add useragent to CURL requests to prevent HTTP error 403.

0.4.1

  • FIX: Handles without a src-value will be registered and enqueued correctly now.
  • CHANGE: The lists don’t show handles without a src-value anymore. These handles don’t represent real files and are only there to force other scripts or styles to be enqueued. (e.g. for backwards compatibility).

0.4.0

  • Required WordPress version raises to 4.4.0.
  • Changed the upper tabs to “Global” and “Single pages”.
  • Scripts and styles can now be controlled on one page. Header and footer can be switched via tabs.
  • Added the ability to control also single pages. They can be added and controlled via the “Single Pages” tab.
    • New pages can be added by pasting the url into the input field and click on “Get Scripts & Styles”.
    • Saved pages can be found in a list on the left. After clicking a list item, the scripts & styles associated with this page will be loaded.
    • The settings for single pages can be easily synchronized with the global settings, if needed.
    • All saved pages can be updated or deleted as once or separately.
  • Improved admin notices for better information about things that happen, e.g. adding/deleting entrys or theme/plugin changes.

0.3.0

  • Changed the name of the plugin to “WP Scripts & Styles Optimizer”.
  • Major improvements in the way how files are handled. Instead of simply deregister any deactivated or conditional file, it now deregisters all files and enqueue them back if not deactivated completely or conditions didn’t match. This means more control over the whole process and is a step forward with view on future features.
  • CSS-files can now moved into the footer! That was only possible due to the change above.
  • The WordPress JavaScript “wp-embed” can now be changed by the plugin.
  • The “jquery” handle has now an explanation text, that it’s only a placeholder for “jquery-core” and “jquery-migrate”.
  • Added plugin version to own javascript and css files to force a reload after update (caching).

0.2.2

  • Improve internal handling of default options
  • Fix a problem that prints a PHP Error in some cases.

0.2.1

  • Complete new UI that no longer use WordPress’s WP_List_Table class. Instead of one table list, it is now divided into lists for scripts and styles, which are itself separated in header and footer.
  • Including Font-Awesome Icon-Library for styling purposes.
  • Added a new option to reset every script or style to its original state. (Per item or as bulk-action)
  • Added a help page to explain the plugin’s functions.
  • Several code improvements

0.1.2

  • Fixed a bug, which triggers a PHP notice for some users

0.1.1

  • Fixed some bugs

0.1.0

  • Initial Release