Strip whitespace from templates for efficiency and to avoid jQuery error