[wp-hackers] Using wp-content/uploads to store dynamically created js and CSS

Nikola Nikolov nikolov.tmw at gmail.com
Thu Jan 9 10:06:23 UTC 2014


I've seen a similar solution, where the generated JS/CSS was stored in the
DB - I know it's not the best solution(since it's still going to load most
of WordPress just to grab that code from the DB), but it seems like an okay
one. Plus if you do output some caching headers(where it says "#Add caching
headers" in his code), then most of the users browsers should have
caching(I believe all modern browsers have caching enabled by default, so
you have to know what you're doing in order to disable it - for instance
developers do that when debugging stuff).


On Thu, Jan 9, 2014 at 10:33 AM, Justas Butkus <jbutkus at time.ly> wrote:

> Hello Brian.
>
> If I see it right, and please correct me if I miss something, your
> proposed solution gives best performance, when site uses a CDN, or at least
> has a caching reverse HTTP proxy in front of WordPress.
>
> In general case - sites don't have anything like this. And then every new
> user (some of whom might have troubles with cache, but let's say that's
> just some 15% increase in traffic) requires your site to build that file.
> If you have a pre-generated JavaScript, served as an actual static file,
> the WordPress isn't even touched, but with your approach every request by
> each new user causes new generation, which might impose significant
> increase in resources utilization.
>
> Maybe you have some considerations how to counter-act that?
> I mean except recommending each and every user to have a
> CDN/caching-proxy, which would be good, just as good as asking everyone to
> use PHP 5.5, which was discussed here few weeks ago. :-)
>
>
> --
> Regards,
> Justas B.
>
> 2014.01.09 00:35, Brian Fegter rašė:
>
>  Nicola,
>>
>> Instead of generating an actual static file, why not use a rewrite? You
>> won't have to deal with the file system at all and any quirks that come
>> with your setup.
>>
>> Heres a gist with the setup I use for this type of thing. This allows you
>> to use object caching and your CDN sees this as a static file as well.
>> https://gist.github.com/inspectorfegter/8325711
>>
>> Let me know if you have any question on this approach. Just another way to
>> skin a cat.
>>
>> Thanks!
>> Brian
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list