Uglify dynamically generated javascript

Hi guys,

In my meteor app, I’m generating a Javascript object using some user data in my collections. I’m creating a dynamic iframe to show to the user some preview of the project that he is creating, using this object to feed some code present in this iframe.

I’m doing something like this:

		Meteor.call("generateData", projectId, function(err,res){
			var iframe = document.createElement('iframe');
			iframe.frameBorder = 0;
			iframe.width = project.width;
			iframe.height = project.height + 20;
			var html = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Test</title></head><script>var Data = ' + JSON.stringify(res) + ' </script><script src="test/preview.js"></script><body></body></html>';
			$(".preview").html(iframe);
			iframe.contentWindow.document.open();
			iframe.contentWindow.document.write(html);
			iframe.contentWindow.document.close();
		});

My question is: How can I uglify this Javscript object and any other javascript code created by me?

In atmosphere the only packages that I found was for uglify the meteor code, not a dynamic code generated this way.

Thanks for all,
Cheers,