Is there any real benefit to using wp_enqueue_script on small self-managed sites? For instance, Modernizr, why enqueue it through a function rather than call it directly inside the document head?
I can see the benefit on large sites, where you may move around directories or have multiple people mucking around in the files, or in a publicly available theme with numerous unknowns, but what’s the benefit on a small site like a personal blog that never – or rarely – changes and has a single user? It just seems like extra lines of code in that case.
Are you using a Theme that you control?
If not, then every time the Theme updates, you’ll lose your modifications to the header. Or else, you’ll have to fork the Theme, or maintain/backport your changes every time the Theme updates.
Do you only use Plugins under your control?
If not, then you’ll have to check for script conflicts every time you activate or update a Plugin that uses a script.
Are you using a core-bundled script?
If so, then you’ll have to check for core script conflicts every time you update core, as well as every time you update a Plugin that enqueues a core-bundled script.
Do you use a caching Plugin?
If so, then you lose some or all of the benefits of script concatenation/minimizing/caching, since your script is hard-coded in the document head rather than enqueued.
1. It only loads scripts when needed
Important for load speed.
2. It safely handles dependencies.
Reduces errors, duplicate loading and js clashing.
3. It handles load order and placement
Tell it where to load and when.
4. Its handles $src properly
Moving the site around, perfect.
5. It has versioning
Helps with caching and ..well versioning.
The “extra lines of code” is irrelevant, especially compared to the benefits of doing it right.