I have been working on optimizing one of my s2Member sites recently and want to open a discussion about optimizing s2Member's dynamic CSS and JavaScript. Currently I have W3 Total Cache enabled on my site and pretty much fully optimized, so now I'm looking at s2Member.
Based on my Firebug/Google Page Speed plugins for Firefox I can see s2Member loads its own dynamic CSS and JS for each member which delays page loading. So I have a number of questions I thought I would pose that maybe can help start the discussion on optimization:
CSS Related
==========
1. Why is the CSS dynamic? Does the styling change from user to user or based on membership level?
2. Could the CSS be cached (static) by W3 Total Cache or other plugins without adversely affecting functionality?
3. Could the s2 CSS be loaded asynchronously to prevent blocking during initial page load? See possible example:
http://is.gd/L1hggh
JavaScript Related
================
1. Could s2Member provide an option to include its JS in the template footer (i.e. call wp_enqueue_script() with $in_footer = true) so that the rest of the page could load without blocking on s2's JS in the page head?
2. Could the s2Member JS be loaded asynchronously without negatively affecting its existing functionality? Something like a call to jQuery.getScript() near the footer of the page would be a great option to load the JS.
3. Could the s2Member JS be broken into a "semi-static" portion and a dynamic portion? The semi-static portion would be common data that could be cached and combined with other JS by W3 Total Cache or other and the dynamic portion would only have the variables directly related to the logged in user. Bonus if the dynamic JS could also dynamically loaded only when needed.
So those are rather technical questions, but I'd love to explore these options and help optimize s2Member. I know most people probably won't go into this level of detail, but for high-performance sites (and increased Google rankings), this type of optimization is a must!
Thanks for a great plugin and I look forward to having s2 on my site for a long time!