Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## -*- coding: utf-8 -*- | ||
<%doc> | ||
This is a Mako template that generates Angular code putting the contents of | ||
HTML partials into Angular's $templateCache. The generated code is then built | ||
with the rest of JavaScript code. The generated script is not used at all in | ||
development mode, where HTML partials are loaded through Ajax. | ||
</%doc> | ||
<% | ||
import re | ||
import os | ||
_partials = {} | ||
for partial in partials.split(' '): | ||
f = file(partial) | ||
content = unicode(f.read().decode('utf8')) | ||
content = re.sub(r'>\s*<' , '><', content) | ||
content = re.sub(r'\s\s+', ' ', content) | ||
content = re.sub(r'\n', '', content) | ||
content = re.sub(r"'", "\\'", content) | ||
dirname, filename = os.path.split(partial) | ||
subdirname = os.path.basename(dirname.rstrip(os.sep)) | ||
_partials[os.path.join(subdirname, filename)] = content | ||
%>\ | ||
/** | ||
* @fileoverview Directive templates cache. | ||
* | ||
* GENERATED FILE. DO NOT EDIT. | ||
*/ | ||
|
||
goog.require('app'); | ||
|
||
(function() { | ||
/** | ||
* @param {angular.$cacheFactory.Cache} $templateCache | ||
* @ngInject | ||
*/ | ||
var runner = function($templateCache) { | ||
% for partial in _partials: | ||
$templateCache.put('${partial}', '${_partials[partial]}'); | ||
%endfor | ||
}; | ||
|
||
app.module.run(runner); | ||
})();\ |