Giter VIP home page Giter VIP logo

webpack-image-resize-plugin's Introduction

webpack-webp-convert-plugin

Resize your images using webpack plugin!

Support

Only webpack 5

Before

이미지 리사이즈 전

After

이미지 리사이즈 후

Usage

npm i webpack-image-resize-plugin --save-dev

or

yarn add -D webpack-image-resize-plugin
// webpack.config.js
const WebpackImageResizePlugin = require("webpack-image-resize-plugin");

...
plugins: [
    new ImageResizePlugin({
      gifInfo: {
        width: 100,
        height: 100,
        toWebp: true
      },
      imgInfo: {
        width: 1920,
        height: 1080,
        quality: 100,
        toWebp: true
      },
    }),
]
...

When you use toWebp options.

Please use file-loader like this. (webpack.config.js)

// webpack.config.js

module: {
    rules: [
      {
        test: /\.(png|jpg|jpg|gif|webp)$/i,
        loader: "file-loader",
        options: {
          name: "static/[name].webp",
        },
      },
    ],
  },

webpack-image-resize-plugin's People

Watchers

 avatar  avatar

webpack-image-resize-plugin's Issues

gif를 리사이징하면 frame이 1장만 남는다.

Sharp 라이브러리와 gifsicle을 exec로 노드에서 직접 실행시키는 방법을 시도했음.

  1. Sharp 라이브러리및 imagemin을 사용하면 리사이징 가능. but Buffer를 다시 webpack asset으로 바꿔주는 과정에서 RawResource에 length가 잘못입력되어 frame이 1개만 남음.

  2. gifsicle을 exec로 직접 실행했더니 결과가 씹힘. webpack plugin이라서 그런가봄.
    코드작업 다 끝나고 수동으로 gifsicle 명령어 치니까 잘됨.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.