Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Server Asset Delivery Optimisation - Need Some Advice...

Featured Replies

I've been playing around with my VPS the last couple days, I decided to split my web project into sub-domains instead of relying on sub-folders.. But I'm not entirely sure how to go about implementing my latest idea. I would prefer to be left to actually code it myself, but I need some help with working out what I need to make the code do.... :)

 

 

So, on with the topic at hand.. I've set up an 'assets' sub-domain, which I'm planning to use for serving assets that are common to my other projects (Twitter Bootstrap, jQuery libraries, branding images, etc). However, instead of simply serving the requested file or files, I'd like to see if I can get my 'assets' sub-domain to combine and minify the requested files.

 

My current idea involves using a PHP-based server-side app that only runs when an asset is requested; at which point it will process the requested files (for example: combine, minify, gzip, etc..) and serve them back to the browser. Perhaps it could even cache the processed files and serve them directly if the source files haven't been changed...

 

But, for all my Googling skills, all I could find was information on how to implement things like this in a self-contained app running off one domain (and more WordPress-related results than I care to count). So I'm not entirely sure how to set up something like this...

 

Anyone have any suggestions for this? I suspect all I need is a starting point for the logic, after that the rest of it should theoretically fall into place quite easily.

  • Author

While driving to work this morning, I had an idea for how I could do this.. The basic idea is to have a simple page on my assets sub-domain with functions that accept an array of file names, then process those and return the end result, rather than trying to catch all URLs and then process them. I'll play around with this tonight when I get home and see how it turns out.

  • Author

Fair points, and very valid as well.. I thought I'd mentioned in my OP that the majority of what I'm doing with this VPS is literally just to have my own little playground and to gain experience. I am already quite familiar with combining and minifying stylesheets and script files served from within the web app's folder, I guess part of this was just to see if I could...

 

If you want to create a sub domain I;d recommend creating soemthing like assets.* and poitning that to a server that runs something Nginx, that is optimised for smalling static files - at least this way, you'd see a benefit. Anyone who uses Tsohost for hosting will know they offer a subdomain built into their hosting that offers this exact feature for the serving of static files.

 

You can also follow basic best practic e guides like using gzip and setting correct expiry headers for your assets too. Start to the htaccess fiole from the html5boilerplate template (google this) or have a read up at http://developer.yahoo.com/performance/rules.html

 

Personally, unless you have something like Nginx setup on your sub domain, I see little point in creating one.

 

The Nginx idea is an interesting one, I've looked at it before, but I was still playing with PHP more than anything else at that stage, so I decided to stick with Apache. It honestly didn't even cross my mind for this particular case until you mentioned it though.. It should at the very least be an interesting experiment though, so I'll probably play around with that.

 

The majority of points listed on that Yahoo page you linked to actually just come down to plain logic, however they are explained very nicely in that particular page. So, I think before I go too much further with any of this, I must first sit and read through it, brush up on the core ideas again, and then start making plans after that. :) Thanks for the tips..

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.