mizziness / craft3-webpack5-tailwind2-boilerplate

A real-world boilerplate for Craft CMS 3 projects that leverages Wepback 5, Tailwind 2, PostCSS 8, and has a hot-reload dev environment. Now with dynamic imports, asynchronous chunk loading, and legacy vs modern browser support!
MIT License
45 stars 11 forks source link

Trigger compiling when tailwind.config.js changes #3

Closed deanfields closed 3 years ago

deanfields commented 3 years ago

Is there a way to trigger a recompile when the tailwind.config.js changes? It's super quick as it is, which is great but it would be nice if it could re-trigger maybe with a command?

mizziness commented 3 years ago

@deanfields Indeed! You can use the webpack watch files plugin like so:

// webpack.dev.js
const WatchExternalFilesPlugin = require('webpack-watch-files-plugin').default;

plugins: [
...
    new WatchExternalFilesPlugin({
      files: [ '../tailwind.config.js' ]
    }),
...