terence55 / themes-switch

Toolset for switch multiple themes in application based on webpack
54 stars 18 forks source link

ClearTemp after dev server ends? #8

Closed WayneHiller closed 2 years ago

WayneHiller commented 4 years ago

ThemesGeneratorPlugin.clearTemp It will delete temp directory. You can call the method as needed, e.g. when you stop webpack-dev-server in development mode.

Do you have an example of how to do this?

terence55 commented 3 years ago

For instance, if you are using create-react-app, you can edit the script scripts/start.js, and call ThemesGeneratorPlugin.clearTemp in the server shutdown function.

['SIGINT', 'SIGTERM'].forEach((sig) => {
      process.on(sig, () => {
        ThemesGeneratorPlugin.clearTemp();
        devServer.close();
        process.exit();
      });
    });