ldr-make-img-tiny-loader

0.0.3 • Public • Published

make-img-tiny-loader

Use tinypng.com upload/download achieve compress images

常见问题

https://cloud.tencent.com/developer/article/1363596

Feature

  • [X] Mini size
  • [X] Cache

Install

$ yarn add --dev make-img-tiny-loader file-loader@latest babel-loader@latest url-loader@latest

OR

$ npm i --save-dev make-img-tiny-loader file-loader@latest babel-loader@latest url-loader@latest

Usage

const path = require('path')

module.exports = {
  mode: 'development',
  entry: {
    app: path.join(__dirname, './demo/index.js') // 打包内容入口
  },
  output: {
    path: path.join(__dirname, './test/') // 出口
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: 'babel-loader'
      },
      {
        test: /\.(png|jpg|gif)$/i,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: 'img/[name].[ext]',
              publicPath: '/'
            }
          },
          { 
            loader: path.resolve(__dirname, './node_modules/make-img-tiny-loader/dist/index.js')
          }
        ]
      }
    ]
  },
  optimization: {
    minimize: false
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i ldr-make-img-tiny-loader

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

16.6 kB

Total Files

4

Last publish

Collaborators

  • ldr_yanhua