Copy and resizes images given an input tree.
Why? For example, to generate a low quality copy of each image and improve the page speed when loading.
npm install --save broccoli-thumbnail
// Raw
const Thumbnail = require('broccoli-thumbnail');
const myTree = new Funnel('assets/images');
const thumbnailTree = new Thumbnail(myTree, {
width: 128,
prefix: 'small-'
});
// Ember addon style
const Thumbnail = require('broccoli-thumbnail');
module.exports = {
// ...
treeForPublic() {
return new Thumbnail('assets/images', { /* options */ });
}
};
Option | Type | Defaults | Description |
---|---|---|---|
prefix | String |
thumbnail_ |
Prefix to be added on each thumbnail name |
extensions | Array |
['jpg', 'jpeg', 'gif', 'png'] |
Files to be processed |
persist | Boolean |
false |
Use disk cache |
width | Number |
64 |
Thumbnail width |
We use SemVer for versioning. For the versions available, see the tags on this repository.
See the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details