MCPcopy Create free account
hub / github.com/ember-cli/ember-cli / compileTemplates

Function compileTemplates

lib/models/addon.js:1087–1111  ·  view source on GitHub ↗

Runs the templates tree through preprocessors. @private @method compileTemplates @param {Tree} tree Templates file tree @return {Tree} Compiled templates tree

(addonTree)

Source from the content-addressed store, hash-verified

1085 @return {Tree} Compiled templates tree
1086 */
1087 compileTemplates(addonTree) {
1088 if (this.shouldCompileTemplates()) {
1089 if (!registryHasPreprocessor(this.registry, 'template')) {
1090 throw new SilentError(
1091 `Addon templates were detected, but there are no template compilers registered for \`${this.name}\`. ` +
1092 `Please make sure your template precompiler (commonly \`ember-cli-htmlbars\`) is listed in \`dependencies\` ` +
1093 `(NOT \`devDependencies\`) in \`${this.name}\`'s \`package.json\`.`
1094 );
1095 }
1096
1097 let preprocessedTemplateTree = this._addonPreprocessTree('template', addonTree);
1098
1099 let processedTemplateTree = preprocessTemplates(preprocessedTemplateTree, {
1100 annotation: `compileTemplates(${this.name})`,
1101 registry: this.registry,
1102 treeType: 'addon-templates',
1103 });
1104
1105 let postprocessedTemplateTree = this._addonPostprocessTree('template', processedTemplateTree);
1106
1107 return postprocessedTemplateTree;
1108 } else {
1109 return addonTree;
1110 }
1111 },
1112
1113 /**
1114 Runs the addon tree through preprocessors.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…