I really like that solution. Not sure if because it's smart or because it's good though.
The only problem I would argue is you lose syntax highlighting, which IntelliJ does so damn well in JS strings.