How to use the @embroider/core.TemplateCompiler function in @embroider/core

To help you get started, we’ve selected a few @embroider/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github embroider-build / embroider / packages / compat / src / compat-app.ts View on Github external
private internalTemplateResolver(): CompatResolver {
    let resolver = new CompatResolver({
      root: this.root,
      modulePrefix: this.modulePrefix(),
      options: this.options,
      activePackageRules: this.activeRules(),
      resolvableExtensions: this.resolvableExtensions(),
    });
    // It's ok that this isn't a fully configured template compiler. We're only
    // using it to parse component snippets out of rules.
    resolver.astTransformer(
      new TemplateCompiler({
        compilerPath: resolveSync(this.templateCompilerPath(), { basedir: this.root }),
        EmberENV: {},
        plugins: {},
      })
    );
    return resolver;
  }
github embroider-build / embroider / packages / compat / src / v1-addon.ts View on Github external
private get templateCompiler(): TemplateCompiler | undefined {
    let htmlbars = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars');
    if (htmlbars) {
      let options = htmlbars.htmlbarsOptions() as HTMLBarsOptions;
      if (options.plugins && options.plugins.ast) {
        // our macros don't run here in stage1
        options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));
        if (options.plugins.ast.length > 0) {
          return new TemplateCompiler({
            compilerPath: options.templateCompilerPath,
            EmberENV: {},
            plugins: options.plugins,
          });
        }
      }
    }
  }