sagold / handlebars-webpack-plugin

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

Fix logic that ignores partials #56

Closed maratfakhreev closed 4 years ago

maratfakhreev commented 4 years ago

Related to https://github.com/sagold/handlebars-webpack-plugin/pull/55

maratfakhreev commented 4 years ago

@sagold ping

maratfakhreev commented 4 years ago

@sagold have you already watched this pr?

sagold commented 4 years ago

Hi maratfakhreev.

I see two issues with this pull request

  1. Its currently based of an old branch nested-partials which conflicts with the current develop branch. Could you adjust it to the changes of the latest commit?
  2. This looks like a breaking change, since an output-template will always receive the folder in its path. I would like to add an opt-in option to keep the directory structure

By the way, have you seen the getTargetFilePath is configurable, which may be used to modify the filepath within the webpack config https://github.com/sagold/handlebars-webpack-plugin#target-filepaths. Could this be used to solve your issue?

As far as i understand there are currently two problems with the plugin

a. partials cannot keep their directory structure b. partials with the same name in different folders overwrite each other.

Is this correct?

sagold commented 4 years ago

Hi maratfakhreev.

I merged your pr to https://github.com/sagold/handlebars-webpack-plugin/tree/pr/55-nested-partials. Some adjustments

That is. The Plugin emits files as before. If you add an output path, like output: path.join(process.cwd(), "build", "[path]", "[name].html") in the handlebars-webpack-plugin-config your logic is triggered and the files emitted with that relative paths.

Does this still fix your issue?