best approach for file structure?

2019-08-31 04:20发布

问题:

What is better / faster?
We need a short and fast file structure for a javascript / ajax web app

rs -> c (for css files)
rs -> j (for js files)
rs -> i (for images)

or:

-> stylesheets
-> scripts
-> images

or:

-> css
-> js
-> img

does it make any difference if the urls are shorter?

回答1:

If you're concerned about two or three bytes in your source code per resource (pre-compression). Then either your website is already highly optimised or you're looking in the wrong place for performance gains.

I'd be more concerned with how your content delivery is spread across things like subdomains/CDNs to maximise load throughput.

Ensure everything is cacheable, also things like ensuring your script includes are bunched up if you can and includes in your CSS.



回答2:

The folder names make no difference. You should focus on actually optimizing your files and how they are delivered.

Once you have optimized your files, consider looking into a content delivery networking like www.cloudflare.com if you are worried about speed.