You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
588 B
18 lines
588 B
var template = require('art-template/dist/template');
|
|
|
|
module.exports = function(source) {
|
|
this.cacheable && this.cacheable()
|
|
|
|
var ANONYMOUS_RE = /^function\s+anonymous/
|
|
|
|
template.onerror = function(e) {
|
|
var message = 'Template Error\n\n';
|
|
for (var name in e) {
|
|
message += '<' + name + '>\n' + e[name] + '\n\n';
|
|
}
|
|
throw new SyntaxError(message)
|
|
}
|
|
|
|
var render = template.compile(source, {}).toString().replace(ANONYMOUS_RE, 'function');
|
|
return 'module.exports = require("art-template/loader/runtime")(' + render + ');';
|
|
} |