noirbizarre / django.js

Javascript tools for Django
http://djangojs.readthedocs.org/en/latest/
GNU Lesser General Public License v3.0
181 stars 80 forks source link

Allow the content type to be passed into the js/javascript script tag. #14

Closed SoftwareMaven closed 11 years ago

noirbizarre commented 11 years ago

As the point with theses template tags is to write less code, Instead of manually specifying the content type for coffee script why not add a coffeescript helper.

I suggest to keep your modification (it allows for unsupported content types) and add both coffee and coffeescript helpers so you can write:

{% js "js/my.coffee" type="text/coffeescript" %}
{% coffeescript "js/my.coffee" %}
{% coffee "js/my.coffee" %}

I'll merge it ASAP before making a new release.

SoftwareMaven commented 11 years ago

I like that idea. I didn't do it because of the profusion of languages like coffeescript, clojurescript, brython, hotruby, etc (see https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS, not all of which can be compiled in the browser), so I thought a more generic solution might be better.

Coffeescript does seem to have the most mindshare right now, so special-casing it it probably worthwhile.

tj

On Sun, Apr 7, 2013 at 11:00 AM, Axel Haustant notifications@github.comwrote:

As the point with theses template tags is to write less code, Instead of manually specifying the content type for coffee script why not add a coffeescript helper.

I suggest to keep your modification (it allows for unsupported content types) and add both coffee and coffeescript helpers so you can write:

{% js "js/my.coffee" type="text/coffeescript" %} {% coffeescript "js/my.coffee" %} {% coffee "js/my.coffee" %}

I'll merge it ASAP before making a new release.

— Reply to this email directly or view it on GitHubhttps://github.com/noirbizarre/django.js/pull/14#issuecomment-16018696 .

Travis Jensen


*Read the Software Maven @ http://softwaremaven.innerbrane.com/ Read my LinkedIn profile @ http://www.linkedin.com/in/travisjensen Read my Twitter mumblings @ http://twitter.com/SoftwareMaven Send me email @ travis.jensen@gmail.com

What kind of guy calls himself the Software Maven???

noirbizarre commented 11 years ago

I agree, coffeescript is more widely used than other alternatives and it might need a special treatment :)

noirbizarre commented 11 years ago

I'll add the coffeescript template tag myself because I need to release.