Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  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();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement