SHARE
TWEET

Untitled

a guest Sep 16th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // webp-convert.js
  2. const imagemin = require('imagemin');
  3. const webp = require('imagemin-webp');
  4.  
  5. const convertImages = async () => {
  6.     const files = ['./input/*.{jpg,png}'];
  7.     const config = {
  8.         destination: './output',
  9.         plugins: [webp({ quality: 75 })],
  10.     };
  11.  
  12.     console.log('開始轉換圖片⋯⋯');
  13.     await imagemin(files, config);
  14.     console.log('已將圖片轉成 WebP!');
  15. };
  16.  
  17. convertImages();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top