I am creating a great “resource pipeline” for an express.js application, but I have a problem with the compression step for javascript files.
scripts = (fs.readFileSync(file) for file in filelist) result = scripts.join("\n\n") # concat
so far, everything is working as expected (the logic itself is written in coffeescript). The next step after merging JS files is to minimize them. But here is my problem: I want to make it “hot” when I run my express application in production mode, from within the middleware I wrote.
I need a solution that can minimize a given piece of javascript without writing the result to disk (!), In other words: a function that performs minimization and returns the result directly as the result value. (No, no web services either.) It should be used as follows:
minified_result = awesomeMinifyFunction( result )
The raw processing performance is not so important to me, nor the level of compression, I just need something that works this way without the hassle.
Does anyone know a suitable solution? Thanks in advance!
source share