in reply to What is your Javascript-workflow?

So I wonder is there a better way to do this?

Yes, seperate templates into seperate files, run tidyall/Code::TidyAll::Plugin::JSLint... on them, then when publishing, if you need to, incorporate into a single file/fatpack... whatever