linkedin / css-blocks

High performance, maintainable stylesheets.
http://css-blocks.com/
BSD 2-Clause "Simplified" License
6.33k stars 152 forks source link

Handle hbs files in the app directory #409

Closed chriseppstein closed 3 years ago

chriseppstein commented 4 years ago

Evidently, it's legal to have templates in the app directory even if you're not using pod-style layout. CSS Blocks should handle those.

ramitha commented 3 years ago

The original RFC that supports templates within the /app directory: https://github.com/emberjs/rfcs/blob/master/text/0481-component-templates-co-location.md

From the RFC, In all of these case, if a template file is present in app/components or addon/components, it will take precedence over any corresponding template files in app/templates, the layout property on classic components, or a template with the same name that is made available with the resolver API. Instead of being resolved at runtime, a template in app/components will be associated with the component's JavaScript class at build time.

Guidance for this is that the block file should also be co-located with the templates and the component JS. So our structure would go from looking like this:

app
├── app.js
├── components
|  ├── app-component.hbs
|  └── app-component.js
├── styles
|   ├── app.css
|   ├── application.block.css
|   ├── components
|   |   └── app-component.block.css

To this:

app
├── app.js
├── components
|  ├── app-component.block.css
|  ├── app-component.hbs
|  └── app-component.js

Likewise in addons.

In the case where the template is co-located, but not the block file, we will get a No blockfile found error.