tuplejump/play-yeoman — pull request #11 by ties (2013-06-30 18:51:42+00:00)
Title: Yeoman controller does not work for coffeescript files in SBT sub-project

Thanks for the development of this plugin. Binding the lifecycle of grunt to the play server keeps it out of your way, and makes development a bit easier.

However, while integrating the plugin into the project with multiple SBT subproject, I ran into the following issue;
#### project setup
```
project
- admin
- ui
- app
- .tmp
- client (another play project)
- common
```

The subproject `admin` uses coffeescript. This means that Grunt compiles the coffeescript files into the `admin/.tmp` directory.

The project is a single SBT build, with two play projects using Scala. The project also has a single shared project, which is still in Java.

#### issue
When running one of the projects (i.e. `play admin/run`), the plugin would not pick up compiled files, and return a 404.

This did not happen when I used regular JavaScript files instead of coffeescript.

### cause
The original code checked for file existence *before* it prepends the Play context path. My build files exist in a sub-directory, but the controller checked from the root directory (i.e. `./admin/ui/.tmp` instead of `./ui/.tmp`).

The original code fell back to the `/ui/app` directory when it did not find a compiled file. When actually *reading* the file, the path was prepended. This bug only shows up when you need compiled files, while working in a sub-project.

### fix
I rewrote (and refactored) the asset handling code.

Unfortunately I do not have tests. Furthermore, when I started I did not think about contributing the patch upstream, otherwise I would have less-invasive changes.

A minimally invasive fix would likely prepend the path at line 39 and 40, which would also fix the bug.