selaux / node-sprite-generator

Generates image sprites and their spritesheets (css, stylus, sass or less) from sets of images. Supports retina sprites. Provides express middleware and grunt task.
MIT License
191 stars 39 forks source link

Pass input source and retrieve output source as buffers #61

Closed lewispham closed 7 years ago

lewispham commented 7 years ago

How can I pass list of input files into node-sprite-generator in buffer format and retrieve the output data as buffer also?

selaux commented 7 years ago

This is planned for the next release and should actually work in current master. Just use fs.readFile and pass the result in to node-sprite-generator.

selaux commented 7 years ago

Well I was not totally correct you have to pass objects like: { path: 'foobar.jpg', data: buffer } as it needs to determine the sprite names from the path.

lewispham commented 7 years ago

I got it. Thanks.

lewispham commented 7 years ago

Oh sorry, but how can I pass multiple bufferred files into node-sprite-generator? Will I need to use an array of objects like the above?

selaux commented 7 years ago

Yes.