cyberdelia/django-pipeline — Issue #54: Javascript template names get an _ prefix on Windows
Author: jjaksic
Created: 2011-12-14 02:01:52+00:00
State: open

On Windows, if you have a template file called mytemp.jst, the resulting template will get named "_mytemp", i.e. the javascript template variable will get stored into window.JST['_mytemp'].

This happens because the pipeline.glob.iglob functions uses os.path.join, which does this:
"js/templates" + "mytemp.jst" = "js/templates\mytemp.jst" (notice the backslash).
When this path reaches pipeline.compressors.template_name, it strips the base path and any forward slashes, but not the backslashes:
```
name = re.sub(r"^%s\/?(.*)%s$" % ( ...
```
Subsequently, it replaces all slashes and backslashes with underscores, so "\mytemp.jst" results into "_mytemp".

This is especially troublesome because it generates different names on Windows than on a Unix.