Skip to content

t49tran/responsive-loader-tinify-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Responsive Loader Tinify Adapter

Using Tinify to compress/resize images for Responsive Loader webpack loader.

Code style

Install

npm install --save-dev responsive-loader-tinify-adapter

Usage

Tinify key

You will need an API key from Tinify

Responsive loader

// Webpack config
const {
  responsiveLoaderTinifyAdapter
} = require('responsive-loader-tinify-adapter');

const config = {
  ...
  module: {
    rules: [
       {
        test: /\.(jpg)$/,
        loader: 'responsive-loader',
        options: {
          name: '[name]-[width].[ext]',
          adapter: responsiveLoaderTinifyAdapter({
              tinifyKey: [YOUR_TINIFY_KEY]
          }) // You can limit this adapter only to run in production mode if you want to
        }
      }
    ]
  },
  ...
}

About

Responsive loader adapter with tinify

Resources

License

Stars

Watchers

Forks

Packages

No packages published