Of course it's handy to have jQuery packaged as a library, but what do you do as a web developer if you're working on multiple projects, some in early developmental stages where you're not even sure if you want or need to use jQuery, other projects actively using it? What I did, what seemed the smart thing to do, is set up each project with a config file, which will get INCLUDE'd via PHP at runtime and which sets paths to central libraries outside the project's directory tree. jQuery's footprint is small by any reasonable standard of enormity in the age of Web2.x; but my thinking is, when you start letting each project squirrel away its own copy of jQuery... and JQ UI... and JQ plugins e.g. Masked Input and Validity... then housekeeping threatens to balloon into a dreadful chore.
So assuming your web service root is /htdocs and you file all your jQuery, JQUI and plugins in /htdocs/lib, then your config script might look something like:
$srvr = 'http://'.$_SERVER['SERVER_NAME']; $jqsource = $srvr.'/lib/jquery/jquery-1.7.2.js'; $jquisource = $srvr.'/lib/jqueryui/jquery-ui-1.8.22.custom.min.js'; $jquicss = $srvr.'/lib/jqueryui/smoothness/jquery-ui-1.8.22.custom.css'; $jqmask = $srvr.'/lib/jquery.maskedinput-1.3.js'; $jqvalidate = $srvr.'/lib/validity/jquery.validity.js'; $jqvalidcss = $srvr.'/lib/validity/jquery.validity.css';...And then when you want to snag a particular library's functionality into your web page, your page HEAD can do:
link rel="stylesheet" type="text/css" href="< ?php echo $jqvalidcss; ?>" / script type="text/javascript" src="< ?php echo $jqsource; ?>" /script script type="text/javascript" src="< ?php echo $jqvalidate; ?>" /script(Can't be arsed to figure out how to make Phosphoros handle mixed markup sanely right now, HTML tags and PHP markers should be obvious)
So then, if you eventually decide "OK this project doesn't need JQUI" or "hey, I need to use the Validate plugin instead of Validity", then it's trivial to fiddle and pare down that project's config.