Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Allow support for sub directories #265

Open
tripodsan opened this issue Jul 10, 2019 · 2 comments
Open

Allow support for sub directories #265

tripodsan opened this issue Jul 10, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@tripodsan
Copy link
Contributor

For project organization, it would be useful to put the htl and js files in sub-directories below src. Although hlx build properly compiles them, they are then not detected by the template resolver.

since we don't have a concept to address components or the like, we could just flatten or prefix the directory to the selector.

1) flattened approach

src/
  - html.htl
  sub1/
    - test_html.htl

so /index.test.html would use the sub1/test_html.htl

2) prefixed approach

src/
  - html.htl
  sub1/
    - html.ht
  sub2/
    - test_html.htl
  • /index.test.html would fail
  • /index.sub2-test.html would use sub2/test_html.htl
  • /index.sub1.html would use sub1/html.htl

The prefixed approach has the advantage that the resolution is always deterministic, but has the disavantage, that you might end-up with 10 different html.htl in your editor.
The flattened approach is just much simpler, but bears the risk of non-deterministic resolution.

@tripodsan tripodsan added the enhancement New feature or request label Jul 10, 2019
@ryanbetts
Copy link

I'm comfortable with Flattened but I think I'd prefer Prefixed.

With Prefixed, it's up to the architect at that point as to whether they want uniquely named files for the sake of IDE experience. But it makes it way clearer which files are being referenced in the source structure.

Couple of questions.

1. With Flattened, how would would this directory structure resolve?

src/
  - html.htl
  sub1/
    - test_html.htl
    - html.htl
  sub2/
    - test_html.htl

My assumption would be:

  • /index.test.html would use src/sub2/test_html.htl
  • /index.sub2-test.html would fail
  • /index.sub1.html would fail
  • /index.html would use src/html.htl if called from the root or another directory
  • /index.html would use src/sub1/html.htl if called from src/sub1/test_html.htl

2. How would additional levels of directory structure resolve with Prefixed?

My guess would be the file /src/pages/home/blogFeed/small_html.htl would be referenced along the lines of /index.pages-home-blogFeed-small.html?

That's about as deep a structure as I can imagine having, personally.

3. What about an alternative pattern for resolving the prefixed approach?

I'm sure there's a good reason this isn't possible, but no harm in asking why we couldn't just honor regular file paths.

eg. /src/pages/home/blogFeed/small_html.htl becomes /pages/home/blogFeed/index.small.html

@trieloff
Copy link
Contributor

I weakly prefer the prefixed approach.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants