Open RobLoach opened 9 years ago
Why?
Hm. Can you give example how you see the things? Let say, how you would use jstransfomer-imagemin
for example?
I think we now can do it
var imagemin = require('jstransformer')(require('jstransformer-imagemin'))
imagemin.renderAsync('images/foo.png', {
plugins: [require('gulp-rename')('bar.png')]
}).then()
// => [{path: 'images/bar.png', contents: <Buffer 89 50 4e ...>}, ...]
im not sure
I'm also not sure about this. JSTransformer's APIs are designed with string rendering in mind. Binary blobs are, at the current stage, abusing the APIs a little bit.
I enjoy abusing APIs :smiling_imp:
var imagemin = require('jstransformer')(require('jstransformer-imagemin'))
imagemin.renderFileAsync('images/foo.png').then(function (result) {
result.body
// => <Buffer 89 50 4e ...>
})
Perhaps just allowing the use of Buffers? Maybe introduce a .renderBuffer()
?
Work with a buffer rather than string?
https://nodejs.org/api/buffer.html