How to Edit The Controller JS File inside the WWW Directory While Compiling The Project?

I want to Change a specific ID Number in Controller JS File inside the WWW Directory while compiling the project. I don’t want to do it manually, I write a new ID to the Controller JS File using NodeJS write function. Is it possible? Then How?