Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Adding support to ignore some file paths during offline compression #335

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
2 participants

ayadav commented Nov 24, 2012

When using compressor with current satchmo stable code, we faced some errors in google checkout payment confirm template because google checkout module is not enabled for the project. This is happening because compressor iterates over the templates directories of all installed apps even if they are not being used or overridden in project.

So we had to make this fix to fix the above satchmo error. As an additional benefit, we are now also using it to improve the speed of compress command by ignoring template directories which do not support compress or are not being used.

Owner

diox commented Nov 24, 2012

I'm not a big fan of ignoring specific template paths, IMHO it forces you to know a little more than you should about template paths. I'm OK with compressor knowing this kind of stuff, but I'd prefer if our users didn't have to care about this kind of stuff.

I think we should try fixing the root of the issue, which is not loading overridden templates in the first place. I've had this idea for quite some time but haven't had the time properly think about the implications and finish implementing it. Basically, the idea is to:

  1. For each loader we are considering, remove leading path (which should be TEMPLATE_DIRS entries, or path to different apps + "/templates") from template paths we are considering. We'll end up with template paths similar to what developers use in their apps instead of full absolute paths
  2. Use get_template() instead of opening the template file manually (see also #282)

I'd prefer to explore this way first and fall back to your original idea if that doesn't work (hint to anyone reading this, you can submit a pull request :). Sounds fair ?

@diox diox closed this May 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment