Add comment to dynamically-generated asset files

To avoid confusion about where these files come from, add a header
comment upon preprocessing that warns people to not modify the
generated files directly, and points them to the appropriate
template file.
This commit is contained in:
Nate Hardison
2013-06-04 11:02:55 -07:00
parent 30d5b8943f
commit 7bccce4e9c

View File

@@ -14,6 +14,7 @@ from django.core.management.base import NoArgsCommand
from django.conf import settings
from mako.template import Template
import textwrap
class Command(NoArgsCommand):
"""
@@ -61,5 +62,12 @@ class Command(NoArgsCommand):
result in `outfile`.
"""
with open(outfile, "w") as _outfile:
_outfile.write(textwrap.dedent("""\
/*
* This file is dynamically generated and ignored by Git.
* DO NOT MAKE CHANGES HERE. Instead, go edit its template:
* %s
*/
""" % infile))
_outfile.write(Template(filename=str(infile)).render(env=self.__context()))