I have a requirement to dynamically generate CSS/JavaScript for my project. After generating this code (most likely with PHP), I need to retrieve the string, minify it, and then save the minified file. I tried looking for a Java/Scala tool that can accomplish this task, but all the tools I came across were designed for minifying project files, not individual files as needed. I considered using wro4j as it seemed like it could potentially solve this issue, however, I couldn't figure out how to implement this within the Java code rather than during build time.