Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before this patch, every request in development caused the template to be compiled, regardless if it was updated in the filesystem or not. This patch now checks the timestamp and only compiles it again if any change was done. While this probably won't show any difference for current setups, but it will be useful for asset template handlers (like SASS), as compiling their templates is slower than ERb, Haml, etc.
- Loading branch information
Showing
4 changed files
with
107 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38d78f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
José, this is causing an incompatibility for the Erector templating engine. Erector templates are pure Ruby classes, and the Erector TemplateHandler uses
require_dependency
to load the template .rb file so that the class constant gets unloaded after each request in development mode. With this change, the class constant still gets unloaded, but the template no longer gets recompiled, so on the next request the constant is missing.Any thoughts on how to fix this?
38d78f9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the best option for erector would be to define an object space finalized that would remove the class when the template object is garbage collected, this would at least allow you to have the performance benefits of this commit and get rid of require_dependency.