Skip to content

Instantly share code, notes, and snippets.

@stephen-james
Created July 22, 2014 13:04
Show Gist options
  • Select an option

  • Save stephen-james/b9114e22c7508f17e1cd to your computer and use it in GitHub Desktop.

Select an option

Save stephen-james/b9114e22c7508f17e1cd to your computer and use it in GitHub Desktop.
cache templates by site area
ngHtml2JsPreprocessor = {
cacheIdFromPath: function(filepath) {
var areaTemplatePattern = /\/?.*\/(.*)\/[Tt]emplates\/(.*\.html)/g;
var pathParts = areaTemplatePattern.exec(filePath);
// cachedTemplates/<AreaName>/<TemplateFileName.html>
var cachedName = 'cachedTemplates/' + pathParts[1] + '/' + pathParts[2];
console.log("[ caching preprocessed template ] " + cachedName + "; original filePath:=" + filePath);
return cachedName;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment