Skip to content

[Feature] Restore separated components: support separate logic and template files (Classic / pre-Octane style) #21051

@nerdy-panda

Description

@nerdy-panda

Hello Ember team,
First, thank you for providing two component patterns — template-only components and components where logic and template are colocated. This flexibility is very valuable for developers.

When a component’s template and logic are combined in a single file, the file becomes crowded and the code can feel messy. Colocating both the component class and its template inside app/components further clutters that directory and makes organization and maintenance more difficult.

Please consider providing a way to separate component logic and templates, similar to the Classic (pre-Octane) style: a separate class file for component logic and a separate template file under app/templates/components or another directory outside app/components. The separated components option should be supported by the framework so teams can choose the style that best fits their needs.

Benefits

  • Improved readability: smaller files focused on a single responsibility.
  • Better maintainability: clearer separation makes refactoring and testing easier.
  • Structural flexibility: Teams can choose per component whether to use separated files (class and template), colocated files (class and template together in the same folder), or a single file that contains both logic and template.
  • Legacy compatibility: eases migration and maintenance of older codebases that used the separated structure.

Thanks again for your work on Ember. This added flexibility would significantly improve the developer experience in larger projects.
Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions