npm install webpack-tinypng-compressa images compress plugin use with tinyPNG for webpack.
$ npm install webpack-tinypng-compress --save-dev
``javascript
var tinypngCompress = require('webpack-tinypng-compress');
//in your webpack plugins array
module.exports = {
plugins: [
new tinypngCompress({
key:"your tinyPNG key",
relativePath: path.resolve(__dirname, 'dist/img') //is relative path to output.puth
})
]
}
`
javascript
new tinypngCompress({
key: "your tinyPNG key", //can be Array, eg:['your key 1','your key 2'....]
relativePath: path.resolve(__dirname, 'dist/img'), //is relative path to output.puth
})
`$3
* key: Required, tinyPNG key
* relativePath: Required, to your img dir,relative to your webpack output path.$3
`javascript
{
key:'',
relativePath:'./',
}
``