HTML and CSS Reference
In-Depth Information
Using existing plugins
Before writing your own plugin, it is useful to check if any plugins are already available that
meet your needs. There is a vast library of plugins available on the Internet. Some are well
supported and widely used; others are unsupported, or used by a handful of people.
Most plugins are available under the MIT license, meaning you are free to modify them in
any way you need.
In this section we are going to use a plugin for generating HTML from a template. The plu-
gin we will use is jQuery Template, and is available here:
You can choose to download either jquery.tmpl.js or jquery.tmpl.min.js.
Alternatively, you can use the following CDN version:
When a library has .min in its name, it is exactly the same as the one without it,
but has been compressed. It is common to compress JavaScript files to improve
download speed, but some people (mistakenly) also see it as a way to add obfus-
cation to their code to stop it being copied.
If you would like to investigate this subject further, or compress your own files,
see this website:
This plugin was originally intended to form part of the core jQuery library, but these plans
have not come to fruition. The library is now largely unsupported, but is still a useful tem-
plating library, and will be used here primarily to demonstrate the use of a jQuery plugin.
If you would like to use a supported templating library on a project, I recommend the Under-
score library, which provides templating functionality that performs essentially the same
In order to use a downloaded version of jQuery Template, first copy it to the scripts folder
of the project. Once in place, add the following to the head section of the page, but after the
main jQuery import:
Search WWH ::

Custom Search