handlebars-webpack-plugin icon indicating copy to clipboard operation
handlebars-webpack-plugin copied to clipboard

Exclude directories in entry piont

Open 5ulo opened this issue 3 years ago • 2 comments

At this moment I have all pages in src/pages dir

entry: path.join(dirPages, '**', '*.hbs'),

but I need to move everything into one src dir which will contain assets, helpers and partials too. Therefore I need to exclude some dirs from entry. I tried glob pattern which wasn't working

entry: glob.sync('./src/!(assets|data|helpers|partials)/**/*.hbs'),

Haven't found any info how to use glob with handlebars-webpack-plugin.

5ulo avatar Sep 09 '20 09:09 5ulo

Hi 5ulo.

the value on entry will be passed through glob within the plugin. Something like the following should work:

entry: './src/!(assets|data|helpers|partials)/**/*.hbs',

sagold avatar Sep 20 '20 09:09 sagold

Thanks for the clue.. this is what I was looking for (includes also files in src's root dir:

entry: './src/!(assets|data|helpers|partials){,**/}*.hbs',

5ulo avatar Sep 21 '20 08:09 5ulo