ericalli / static-site-boilerplate

A better workflow for building modern static websites.
http://staticsiteboilerplate.com
MIT License
1.74k stars 166 forks source link

Integrate file-include-webpack-plugin #37

Closed stewartwright closed 3 years ago

stewartwright commented 4 years ago

Unable to integrate file-include-webpack-plugin Been trying to get the following working with SSB but can't seem to. https://github.com/Vishal0203/file-include-webpack-plugin

Managed to ignore the files in the partials directory I created however the partials dont merge into the html parents. Any ideas or alternatives appreciated!

traf commented 4 years ago

I'm looking for something similar. Components or partials are required for me in any sort of boilerplate. Is there an easy way to integrate this?

IcepickD commented 3 years ago

For anyone in the future looking an answer to this problem. There is no need to include additional libraries. If your partials are in a special folders ignore them in the html-webpack-plugin using the ignore option from this const generateHTMLPlugins = () => glob.sync('./src/**/*.html').map((dir) => { to this const generateHTMLPlugins = () => glob.sync('./src/**/*.html', { ignore: ['./src/partials/*.html'] }).map((dir) => {

then just use html-loader in your html file ${require('./partials/partial.html')}

ericalli commented 3 years ago

@IcepickD This is a great solution. I don't think it should be a part of the core SSB codebase, but I will for sure add this tip to the documentation.