Skip to content

A packaging of Paul Irish's HTML5 Boilerplate for Django projects.

Notifications You must be signed in to change notification settings

UXE/django-html5boilerplate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

django-html5boilerplate

This project is a packaging of Paul Irish's HTML5 Boilerplate for Django projects. It contains a base template, the required media, and—most importantly—a collection of template tags so you can easily integrate all of the boilerplate's tricks into your pages if the template starts to feel too restrictive.

The bundled media and templates correspond to the 1.0 release of HTML5 Boilerplate.

Installation

Add html5boilerplate to INSTALLED_APPS in settings.py. If you plan to make use of the included media (bundled JavaScript and CSS files), either copy the media folder to your project or duplicate whatever setup you're using for your admin media files (collectstatic, symlink, server alias, etc.)

Usage

You can either extend the included template ("html5boilerplate/base.html"), or create your own using the included template tags, which can be loaded using {% load html5boilerplate_tags %}. Here is a list of the included tags:

google_analytics
Embeds the GA tracking script. You can either pass it your tracking code, or set `GA_TRACKING_CODE` in settings.py
tagvariants
Creates duplicates of the wrapped opening tag, each wrapped in an IE conditional comment, with an added class identifying the version of IE. For example:
{% tagvariants %}<html lang="en" class="whatever">{% endtagvariants%}
would result in the following:
<!--[if lt IE 7 ]><html lang="en" class="ie6 whatever"><![endif]-->
<!--[if IE 7 ]><html lang="en" class="ie7 whatever"><![endif]-->
<!--[if IE 8 ]><html lang="en" class="ie8 whatever"><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en" class="whatever"><!--<![endif]-->
	This would usually be used on the `&lt;html>` tag, and allows you to
	easily target versions of your favorite browser.
</dd>
<dt>load_jquery</dt>
<dd>Loads jQuery by trying each item in a list of sources until one is
	successful. By default, this tag will first try to load the library
	from Google's CDN and then—if it fails—will load the bundled copy.
	However, you can override this behavior by either passing a list of
	sources to the tag or setting `JQUERY_SOURCES` in settings.py.
</dd>

Settings

This application supports the following settings:

GA_TRACKING_CODE
A default tracking code to use for the `google_analytics` template tag. If this is set, you can use the template tag without arguments.
JQUERY_SOURCES
A list of sources that jQuery can be found at, in the order in which they should be tried. If this is set, you can use the `load_query` tag without arguments.
HTML5_BOILERPLATE_STATIC_PREFIX
A prefix to be used for the bundled media urls. By default, the template will use "/static/html5boilerplate/".

About

A packaging of Paul Irish's HTML5 Boilerplate for Django projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published