Git Product home page Git Product logo

django-html5boilerplate's Introduction

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/".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.