sagold / handlebars-webpack-plugin

Renders your html-template at build time
161 stars 45 forks source link

Can't add partial path that is sub-folder where of entry point #64

Closed raypatterson closed 3 years ago

raypatterson commented 4 years ago

I have a project with a set of files like:

src
└── pages
    ├── index.hbs
    └── partials
        └── section-1.hbs

The plugin config looks like:

new HandlebarsPlugin({
    entry: "src/pages/**/index.hbs",
    partials: [
      "src/pages/**/!(index).hbs"
    ]
  });

The partial section-1.hbs is added but I see the error:

ERROR  [
  'src/pages/index.hbs: is ignored'
]

It appears this LOC evaluates to true because the partial file path and the entry file path share a common, parent folder, pages.

https://github.com/sagold/handlebars-webpack-plugin/blob/b8c7af5106c8f5d3b49428c4cd450ea11e4f8e67/utils/getRootFolder.js#L30

I'm wondering if there is some way to preserve this folder structure and also avoid this error.

Please let me know if I can provide any more information. Thanks!

sagold commented 4 years ago

Hi raypatterson.

Thank you, for the detailed issue description. The mentioned check came in from a pr and i have neither tests, nor documentation for this. If you like, tryout the branch issue-64-entry-within-partials. This might solve your issue.

I currently have no time retracing the requirements for the removed check.

raypatterson commented 4 years ago

Works! The changes in the branch make it so partials can exist in sub-folders where entry points also exist.

raypatterson commented 4 years ago

@sagold thanks for fixing this. Is there anything I can do to help get it into a PR?

raypatterson commented 3 years ago

@sagold just checking back in on this one since it looks like your fix is solid, and could be good to go? Thanks again!

sagold commented 3 years ago

Hi Ray.

Thank you for the constant reminders. I finally merged this branch and published the package with version v2.0.0.

Cheers, sagold

raypatterson commented 3 years ago

Amazing, thanks so much!

As an aside, I'm also looking forward to the release of https://github.com/sagold/handlebars-webpack-plugin/issues/62

sagold commented 3 years ago

This pr should be within v2.0.0 release. I will confirm this in two days.

raypatterson commented 3 years ago

Double amazing! Thanks again!