Skip to content

Support out-of-module templates #22

@dfreeman

Description

@dfreeman

Currently, glint supports GlimmerX-style components, where a component's template is defined using a tagged template literal inside its class body.

Regardless of the form factor strict mode and template imports ultimately take, to support today's idioms in Ember we need to be able to consume templates in standalone files. This forces the introduction of some amount of project-structure knowledge into glint, but fortunately isolating these sorts of details is exactly the kind of thing environments were introduced to handle.

We probably want to support template-only components and colocated component/template pairs as a minimum starting point. That is, if <root> refers to app or addon as appropriate, then:

  • <root>/components/<name>.hbs should pair with <root>/component/<name>.ts if present
  • <root>/components/<name>.hbs should be treated as a template-only component otherwise (and if no other cases described below apply)

There are a pretty large number of other cases we can hopefully eventually detect well enough to support route/controller templates and to give folks in classic/pods layouts a migration path.

  • <root>/templates/components/<name>.hbs should pair with <root>/components/<name>.ts if present
  • <root>/templates/<name>.hbs should pair with <root>/controllers/<name>.ts if present
  • <root>/<path>/template.hbs should, in order:
    • pair with <root>/<path>/component.ts if present
    • pair with <root>/<path>/controller.ts if present
    • be treated as template-only otherwise (is /template the import path?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions