Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.43 KB

README.rst

File metadata and controls

50 lines (34 loc) · 1.43 KB

Django Pipeline Handlebars

django-pipeline-handlebars is a compiler for django-pipeline.

This compiler will produce a JS using the widely used JST model.

It basically compiles and appends to the window.JST JSON array the template that you request (through django-pipeline) using for example Backbone.js or Spine.js .

Installation

Add repository url to your requirements or buildout.cfg, then run

pip install -r requirements

or

buildout

Add these lines in your django settings.py:

PIPELINE_JS = {
    'application': {
        'source_filenames': (
            # Your other JS files...
            'path/to/your/templates/*.html',#save your handlebars templates with html extension
        ),
        'output_filename': 'js/application.js'
    }
}

PIPELINE_COMPILERS = (
    'pipeline_handlebars.compiler.HandlebarsCompiler',
)

Usage

If the paths are set correctly (try to play a bit depending on your static files situation), the handlebars templates will be compiled in a JS file and included automatically by pipeline.

Inspired by