I'm working on a PHP class that takes my JS assets and builds a minified and concatenated version to a one script file with all the assets inside ready for production. My only concern is that it may break something. For example, if the build concatenates a file after it's needed (for example, jQuery core after a jQuery plugin). I intend it to be the most automatic that I can (I was thinking reading the scripts directory), but this could lead some problems.
I also saw Buildr and alse seems a great solution. It does the same, builds everything that it's inside a directory, but maybe it has the same problem?
Any solution for this? Something like wrapping JS code somehow for this?