There is the web-mode for emacs [1] to manipulate files with different languages. It is oriented for editing templates but something more general should be possible.
Currently I am using it a lot to write React's JSX which combine javascript and XML.