To understand Fanstatic, it’s useful to understand the following concepts.
Resources can be included in a web page in several ways.
included using the
script tag, for instance like this:
and CSS files, which are included using a
link tag, like this:
<link rel="stylesheet" href="/something.css" type="text/css" />
elsewhere on the page, such as at the bottom.
Fanstatic can generate these resource inclusions automatically for you and insert them into your web page.
Fanstatic doesn’t do anything special for the inclusion of image or
file resources, which could be included by the
tag. While Fanstatic can serve these resources for you, and also knows
how to generate URLs to them, Fanstatic does not automatically insert
them into your web pages: that’s up to your application.
Fanstatic lets you define resources and their dependencies to make the automated rendering of resource inclusions possible.
You can see a resource inclusion as a Python import: when you import a
module, you import a particular file in a particular package, and a
resource inclusion is the inclusion of a particular resource (
.css file) in a particular library.
Fanstatic takes care of inserting these resources inclusions on your web page for you. It makes sure that resources with dependencies have their dependencies inserted as well.
How do you tell Fanstatic that you’d like to include jQuery on a web page? You do this by making an resource requirement in Python: you state you need a resource.