Build a PHP page from snippets with NodeJS and JSDOM/jQuery

I am playing with creating a PHP page from ready code snippets and modify the page with JSDOM/jQuery. For example, I have this code:

window.$('title').text('<?php wp_title(); ?>');

But it inserts php tags escaped. How to make it put this string as it is without escaping?

I tried another library named Cheerio and code looking like this works just fine now:

$('title').html("<?php wp_title(); ?>");

No characters are being escaped and I can properly save this to a file.

Update: The reason why I am doing it is that I have to deal with WordPress themes creation and I want to streamline the process. As I am nor a big fan of PHP neither of WordPress themes structure, I want to build sets of files in Jade, run them through Express, then with an automated process compile them as a Wordpress theme. I have some success in doing this. Now I use Jade mixins to turn this:

+title

into something like this:

<title><?php wp_title(); ?>

in its simplest form.

So this way I can keep my templates easy to modify, nice and pleasant to work with.

Use the html method if you don't want your content to be escaped

window.$('title').html('<?php wp_title(); ?>');

But be careful that your title doesn't contain a new line or a quote . That's why I prefer to use

// Using the version of wp_title that returns something instead of printing 
// directly to the output
window.$('title').html(<?php echo json_encode(wp_title('', true)); ?>);