Skip to content

ember.js precompiler for projects that use the django compressor

License

Notifications You must be signed in to change notification settings

omarestrella/django-ember-precompile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ember.js precompiler for projects that use the django compressor

##Why did you write another precompiler npm module?

  1. django projects have a quick hook to execute code with django compressor
  2. I prefer to precompile my handlebars templates for ember.js when possible
  3. I couldn't find an existing npm module that was built to work with django compressor and ember.js

##How do I get started then?

First you need to install node.js if you have not already

http://nodejs.org/download/

Install the npm module

npm install django-ember-precompile

Add django compressor to your django web project

pip install -r django_compressor

Register a type to have the compressor fire off the precompile step (in your settings.py)

COMPRESS_PRECOMPILERS = (
    ('text/x-handlebars', 'node_modules/django-ember-precompile/bin/django-ember-precompile {infile}'),
)

Finally in your html you need to reference the uncompiled handlebars templates

{% load staticfiles %}
{% load compress %}

{% compress js %}
<script src="{% static 'script/app/templates/foo.handlebars' %}" type="text/x-handlebars"></script>
{% endcompress %}

This npm module makes a few assumptions to correctly register the template name with ember.js

1.) Each template must have a file extension of "handlebars"
2.) Each template must reside under a root "templates" directory

##Development

To run the tests

cd tests
./runner.sh

About

ember.js precompiler for projects that use the django compressor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 93.4%
  • Ruby 3.4%
  • Shell 3.2%