coderaiser/minify

stream

Closed this issue · 3 comments

can we pipe stream to minify ?

Yes, you can, with:

cat *.css | minify -css

I am looking for something like

myFileStream.pipe(minify).pipe(storeInCache)

My goal is the cache manager automaticaly store minified files in ram if environment is production.

Unfortunately uglify and html-minifier which are used in minify doesn't support streams. They load file completely and then process it.

About loading to ram, stream doesn't works this way. You can just process files with minify and store results in variables or something:

minify('client.js', function(error, data) {
    if (error)
        console.error(error.message);
    else
        console.log(data);
});