I believe there's a `replaceRequireScript` in grunt-requirejs that would probably make this cleaner.