Skip to content

File naming conventions for styles/templates #208

Closed
@evanplaice

Description

@evanplaice

The current structure assumes that the html and css files are tightly bound to a specific component. Which is fine but the file type is the only indicator of it's usage. Currently html/css are the only supported formats but consider where future support may be added (by plugins or otherwise) for other formats (ex liquid, scss).

What I suggest is labeling the HTML/CSS files with a suffix that describes their role.

before:

...
|-- app
|   |-- hero
|   |   |-- hero-detail.component.html
|   |   |-- hero-detail.component.css
|   |   |-- hero-detail.component.spec.ts
|   |   |-- hero-detail.component.ts
|   |   |-- hero-list.component.html
|   |   |-- hero-list.component.css
|   |   |-- hero-list.component.spec.ts
|   |   |-- hero-list.component.ts
|   |   |-- hero-root.component.spec.ts
|   |   |-- hero-root.component.ts
|   |   |-- hero.service.spec.ts
|   |   |-- hero.service.ts
|   |-- ...
|-- app.ts
...

after:

...
|-- app
|   |-- hero
|   |   |-- hero-detail.view.html
|   |   |-- hero-detail.view.css
|   |   |-- hero-detail.component.spec.ts
|   |   |-- hero-detail.component.ts
|   |   |-- hero-list.view.html
|   |   |-- hero-list.view.css
|   |   |-- hero-list.component.spec.ts
|   |   |-- hero-list.component.ts
|   |   |-- hero-root.component.spec.ts
|   |   |-- hero-root.component.ts
|   |   |-- hero.service.spec.ts
|   |   |-- hero.service.ts
|   |-- ...
|-- app.ts
...

When other platforms are better supported, this can be extended to define platform-specific views.

example:

...
|-- app
|   |-- hero
|   |   |-- hero-detail.view.html
|   |   |-- hero-detail.view.css
|   |   |-- hero-detail.mobile.html
|   |   |-- hero-detail.mobile.css
|   |   |-- hero-detail.desktop.html
|   |   |-- hero-detail.desktop.css
|   |   |-- hero-detail.component.spec.ts
|   |   |-- hero-detail.component.ts
|   |   |-- hero-list.view.html
|   |   |-- hero-list.view.css
|   |   |-- hero-list.mobile.html
|   |   |-- hero-list.mobile.css
|   |   |-- hero-list.desktop.html
|   |   |-- hero-list.desktop.css
|   |   |-- hero-list.component.spec.ts
|   |   |-- hero-list.component.ts
|   |   |-- hero-root.component.spec.ts
|   |   |-- hero-root.component.ts
|   |   |-- hero.service.spec.ts
|   |   |-- hero.service.ts
|   |-- ...
|-- app.ts
...

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