Thursday, April 21, 2011

Essential JS files

When starting with a new web site there are certain files that you will need to include to have a modern and well functioning site.  Obviously your site may be more minimal and therefore you could not add them but here are the ones that I try to include.

Jquery
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>

Most sites that I build use jquery and why not let the google content delivery network take the strain and host it for me  directly from Google’s network of datacenters.  Benefits include decreased latency, increased parallelism, and better caching.



HTML5 shim
<!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
   <![endif]-->


Also the same as shiv, this js file is to be added if you are building in html5.  This script tells IE what the html5 elements are.  Use in conditional statements



Modernizr
<script src=" /js/modernizr-1.6.min.js"></script>

Modernizr is is an open-source JavaScript library that allows you to use CSS3 and HTML5 as it adds classes to the <html> element which allow you to target specific browser functionality in your stylesheet.  This means that you can take full advantage of all the HTML5 and CSS3 features that will be implemented in some browsers, without sacrificing control over the user experience in other browsers.

No comments: