Is it useful to put .css and .js files on a CDN?

Most people seem to use CDNs to host images and / or videos. Is it right to put js and css on cdn?

+5
source share
5 answers

I think so. However, if any of them are dynamically generated, you will want to place relatively files with relatively low ttl time (time to live), so that the CDN knows that you need to get fresh copies. However, if this is not the case, I think that dumping them on Amazon S3 would be nice.

One caveat is to make sure you have an easy way to test and develop without using CDNs, as caching can be a headache during this process.

[]
, , w/i , .

:

style.20111112.css
shoppingcart.20111113.js

ttl CDN .

+3

, .

Javascript, CDN js - , .

, jQuery :

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
    document.write(unescape("%3Cscript src='/scripts/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E"));
</script>

+3
+1

, - ( javascript, , javascript).

0

CDN.

Akamai CDN, , CDN ( , " " ), , .

CDN, Akamai, - , . 15 3 .

I suggest reading the wikipedia benefits section to learn more.

0
source

All Articles