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

Nicola Peluchetti nicola.peluchetti at gmail.com
Thu Jul 31 13:05:03 UTC 2014


Otto,

if i choose to ouput the CSS directly in the page without triggering
another request, what's the best action to use, wp_head?
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head


*Nicola Peluchetti - Senior PHP Developer @ Timely*
Twitter: @nik_peluchetti <https://twitter.com/#!/nik_peluchetti>
Facebook: nicola.peluchetti <https://www.facebook.com/nicola.peluchetti>
Stackoverflow: Stackoverflow
<http://stackoverflow.com/users/397861/nicola-peluchetti>
Mobile: +39 339 7507235


On Thu, Jan 9, 2014 at 3:23 PM, Brian Fegter <brian at fegter.com> wrote:

> @Justas & @Nicola - I understand your point there and I agree it's better
> to hit the file system before the DB. I missed the point that this was a
> distributed plugin compared to a single site..
>
>
> On Thu, Jan 9, 2014 at 4:06 AM, Nikola Nikolov <nikolov.tmw at gmail.com
> >wrote:
>
> > 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
> > >
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
> _______________________________________________
> 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