D
D
Dima Pautov2018-04-03 14:21:43
JavaScript
Dima Pautov, 2018-04-03 14:21:43

How to correctly specify the path to the hbs component?

Good afternoon guys. I am making a blank for building regular html pages using webpack. I decided to use handlebars as a template engine.
For webpack, I use the handlebars-webpack-plugin plugin . I added my setting to the plugins section:

new HandlebarsPlugin({
            entry: path.resolve(__dirname, "app", "html", "pages", "*.hbs"),
            output: path.resolve(__dirname, "dist", "[name].html"),
            partials: [
                path.resolve(__dirname, "app", "html", "components", "*", "*.hbs")
            ]
        })

Everything works fine, the pages from the pages section are displayed perfectly, but I can’t connect parts of the template from the components section. Constantly writes that the file is not found.
As soon as I did not write the connection, everything is in vain !!!
{{> html/components/header}}
{{> components/header}}
{{> header}}
{{> ../components/header}}

folder structure
5ac363f2cf415304730653.png

Help me to understand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sinneren, 2019-03-04
@sinneren

{{> header/header}}
components/header/header.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question