How to modify the contents of specified variables in js files by nodejs

there is js code in a html file.
node modifies the variable value in js code

Mar.04,2021

use fs.readFile () to read the file, then use replace () to match and replace variable values, and then fs.writeFile () go back


using the html template engine
if it is, you can pass the value directly like an ejs template, oh


[how nodejs modifies the specified variable content in the js file] is there a good way?

Menu