0.6.9-beta.1 • Published 3 years ago

@yhtml5/upload-images v0.6.9-beta.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

yhtml5-update-images

An automated tool for compressing and optimizing JPEG or PNG images, and then upload to cdn return urls.

  1. Compress picture
  2. Upload images to cdn
  3. Return url

start

Create .config.js under the picture folder

Read the config in the root directory by default

const path = require('path')
const entry1 = path.resolve(__dirname, './images/*.{jpg,png}')

const config = {
  upload: {
    entries: [entry1],
  }
}

module.exports = config

use in the global

npm i @yhtml5/upload-images -g upload /path/to/config.js

old workflow

  • open https://tinypng.com/
  • upload images
  • download images
  • open upload images tool
  • upload images
  • copy image link

new workflow

  • npm run upload
  • return url

notice

  • 每次只上传一个文件 减轻的服务器压力

other

imagemin