coderaiser / minify

Minifier of js, css, html and img
https://coderaiser.github.io/minify
MIT License
228 stars 29 forks source link

stream #38

Closed ghost closed 8 years ago

ghost commented 8 years ago

can we pipe stream to minify ?

coderaiser commented 8 years ago

Yes, you can, with:

cat *.css | minify -css
ghost commented 8 years ago

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.

coderaiser commented 8 years ago

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);
});