Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Strategy Session: Minified or Full for Theme Version
Lab: Automate Asset Versioning – Better Asset Versioning
Video Runtime: 12:25
This episode is different. In this one, we’re talking strategy. It’s time to think about how we should approach setting the theme’s version. Should we use the minified or full stylesheet? Does it matter?
Hmm, first, we need to look at how WordPress does it. Then we’ll look for a mechanism to change between the files.
Let’s walk through WordPress Core and look at how it extracts the stylesheet’s version. We’ll explore wp_get_theme()
.
Spoiler alert: there is no mechanism. Bummer.
Okay, then let’s talk through if we need to change our code or not.
Better Strategy
The process that I showed you previously, of copying the full stylesheet and pasting it into an online minifier is a bad strategy. Why? It’s a highly manual workflow that consumes your time. It’s prone to errors and forgetting to do it.
Instead, use gulp, grunt, codekit, or whatever to automate that task for you. That’s a better strategy as it makes you more productive and mitigates the risks.
If you use an automated minifier, then our current code strategy is okay. Why? Both files will have the same version number in them. Then there’s no need to add extra code.
Break. Go rest your noodle for a couple of minutes.
Episodes
Total Lab Runtime: 02:27:07
- 1 Lab Introductionfree 11:19
- 2 Why is Version Number Necessary?free 16:30
- 3 Version Numbering Schemepro 06:47
- 4 Forget Hard Coding Version Numberpro 15:02
- 5 Forget Hard Coding - Grab Stylesheet's Versionpro 05:19
- 6 Forget Hard Coding - Genesispro 05:17
- 7 Load the Theme's Minified Stylesheetpro 10:23
- 8 Strategy Session: Minified or Full for Theme Versionpro 12:25
- 9 Load the Minified Stylesheet in Genesispro 05:04
- 10 Refactor to Improve Our Codepro 11:20
- 11 Applying It to Scriptspro 18:14
- 12 Apply it to Scripts - Genesispro 09:13
- 13 Convert into Utility File - for Reusepro 14:30
- 14 Wrap it Upfree 05:44