colbyfayock / html-webpack-partials-plugin

🛠 Easy HTML partials for Webpack without a custom index!
MIT License
68 stars 20 forks source link

Live reload #33

Open raloliver opened 3 years ago

raloliver commented 3 years ago

When I use serve from webpack, the live reload does not works when I change a partial file.

colbyfayock commented 3 years ago

hey @raloliver im guessing it's similar to this issue here? https://github.com/colbyfayock/html-webpack-partials-plugin/issues/15

this isn't currently utilizing the pipeline to effect where it could take advantage of live reload or more benefits from the full webpack / html webpack plugin system

open to ideas if you have any or are more familiar with the inner workings

vincenttaglia commented 3 years ago

@raloliver check out https://github.com/pigcan/extra-watch-webpack-plugin. Live reload is working on the following configuration.

My directory structure:

├── /dist                    # Webpack and Tailwind output directory
│   ├── index.html              # Render of index.html template with partials
│   ├── main.js                 # Main output for Webpack/Stimulus
│   └── tailwind.css            # Main output for Tailwind
├── /src                     # Source folder
│   ├── /controllers            # Stimulus Controllers Folder
│   ├── /partials               # HTML Partials Folder
│   ├── /templates              # HTML Templates Folder
│   ├── index.js                # Webpack Entry Point
│   └── tailwind.css            # Tailwind CSS Entry Point
├── package.json             # Yarn package.json
├── postcss.config.js        # PostCSS config
├── tailwind.config.js       # Tailwind Config
├── webpack.config.js        # Webpack Config
└── yarn.lock                # Yarn Lockfile

And this is my webpack.config.js plugin:

new ExtraWatchWebpackPlugin({
    dirs: [ path.join(__dirname, 'src') ],
}),