Commit a8811960 by Timothée Peignier

don't compile not outdated file, for fastest development

parent dd2eed6e
......@@ -29,14 +29,16 @@ class Compiler(object):
compiler = compiler(self.verbose)
if compiler.match_file(path):
new_path = self.output_path(path, compiler.output_extension)
content = self.read_file(path)
paths[index] = new_path
if not self.is_outdated(path, new_path):
continue # No need to re-compile this file
try:
content = self.read_file(path)
compiled_content = compiler.compile_file(content, finders.find(path))
self.save_file(new_path, compiled_content)
except CompilerError:
if not self.storage.exists(new_path) or not settings.PIPELINE:
raise
paths[index] = new_path
return paths
def output_path(self, path, extension):
......@@ -49,6 +51,12 @@ class Compiler(object):
file.close()
return content
def is_outdated(self, path, new_path):
try:
return self.storage.modified_time(path) > self.storage.modified_time(new_path)
except OSError:
return True
def save_file(self, path, content):
return self.storage.save(path, ContentFile(smart_str(content)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment