0

Using Nuxt.JS, while on development with npm run dev, I want to trigger the command npm run prettier automatically when saving, to keep the code clean.

In any other project, I would achieve this with Nodemon with the following nodemon.json:

{
  "events": {
    "restart": "npm run prettify"
  }
}

However Nuxt.JS doesn't seem to use Nodemon and/or it does not expose any "on change" event either.

How can I run a custom script when Nuxt.JS reloads?

Note: Looking for a solution not dependent on VSCode.

adelriosantiago
  • 7,762
  • 7
  • 38
  • 71
  • I do recommend this approach: https://stackoverflow.com/a/68880413/8816585 – kissu Mar 24 '22 at 15:11
  • That approach is good @kissu and I use it often on offline projects. However the code is edited online, through a web editor. So I am looking for a solution not dependent on VSCode. – adelriosantiago Mar 24 '22 at 17:27
  • The only remaining thing is to launch ESlint in any kind of code editor/IDE or run an ESlint service in the background to have it working. – kissu Mar 24 '22 at 18:46

0 Answers0