Dynamically create JavaScript source code using Jint in C#

110 views Asked by At

I am working on a project where it requires to parse large numbers of .js files and programmatically update JavaScript code and save it to the same location from where it is loaded.

Is this possible to do this using the Jint Engine and JavaScript Parser and could you please how to do this?

For Example, I have many JavaScript files in different folders scripts.js with the following lines of code

(function () {
    return {
        ready: function () { 
            
            
        },
        destroy: function () { 
            
        },
    }
});

I have to convert these files using C# as follows

(function () {
    return {
        ready: function () { 
        console.log("scripts.ready called");
            
        },
        destroy: function () { 
            console.log("scripts.destroy called");
        },
    }
});

Please help me how to achieve this using Jint in C#. Is there any other library that can be used to dynamically/programmatically create javascript code

0

There are 0 answers