Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saintedlama/metalsmith-tinify
A metalsmith plugin to compress images uning the tinify API
https://github.com/saintedlama/metalsmith-tinify
Last synced: about 1 month ago
JSON representation
A metalsmith plugin to compress images uning the tinify API
- Host: GitHub
- URL: https://github.com/saintedlama/metalsmith-tinify
- Owner: saintedlama
- License: isc
- Created: 2017-02-10T10:44:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-10T09:26:24.000Z (almost 2 years ago)
- Last Synced: 2024-09-25T16:58:21.707Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# metalsmith-tinify
[![npm version][npm-badge]][npm-url]
[![Build Status][travis-badge]][travis-url]A metalsmith plugin to compress images uning the tinify API using a local cache to minimize API calls.
## Installation
```bash
$ npm i metalsmith-tinify --save
```## Example
```Javascript
const Metalsmith = require('metalsmith');
const tinify = require('metalsmith-tinify');Metalsmith(__dirname)
.source('./src')
.destination('./build')
.use(tinify({
apiKey: 'yourapikey', // Required: Get your API key from https://tinypng.com/developers
}))
.build(function(err) {
if (err) throw err;
});
```## Options
You can pass options to `metalsmith-tinify` with the [Javascript API](https://github.com/segmentio/metalsmith#api)
or [CLI](https://github.com/segmentio/metalsmith#cli).The options are:
##### apiKey
* `required`
Tinify API key - you can get your api key from https://tinypng.com/developers
##### pattern
* `optional`
* `default: ['**/*.jpg', '**/*.jpeg', '**/*.png']`A [multimatch](https://github.com/sindresorhus/multimatch) pattern. Only files that match this pattern are tinified.
Can be a string or an array of strings.##### cacheDir
* `optional`
* `default: path.join(os.tmpdir(), 'metalsmith-tinify-cache')`All once tinified images are cached. This options specifies the cache directory to use.
## Problems?
You can allways switch debugging output on by setting NODE_DEBUG environment variable to `metalsmith-tinify`.
See the awesome [debug module](https://www.npmjs.com/package/debug) for more details.## License
ISC
[npm-badge]: https://img.shields.io/npm/v/metalsmith-tinify.svg
[npm-url]: https://www.npmjs.com/package/metalsmith-tinify[travis-badge]: https://travis-ci.org/saintedlama/metalsmith-tinify.svg?branch=master
[travis-url]: https://travis-ci.org/saintedlama/metalsmith-tinify