Skip to content

Images are processed automatically, such as 1X, 2x, webp, Base64, etc. based on the requirements, and can also automatically turn the pictures on the page into Base64 format.

Notifications You must be signed in to change notification settings

xingzhiFun/imageAutoprefixer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imageAutoprefixer

Images are processed automatically, such as 1X, 2x, webp, Base64, etc. based on the requirements, and can also automatically turn the pictures on the page into Base64 format.

Blog Link

Version

v1.1

Support

根据已有2x图,自动生成1x图、webp格式图片、base64格式json文件,自动替换html代码中的图片为base64

Run

node imageAutoPreFixed.js

Configure

config.js中

module.exports = {
    pathroot: './dist/'
};

在此处,pathroot配置的是项目相对imageAutoFixed.js的相对路径,例如项目b就是./dist/b

RequireMent

约定:

  1. 项目下需要有一个images文件夹

  2. 需要操作的图片对象命名格式为*_2x.png或者*_2x.jpg等等

  3. 如果需要自动将html中的图片替换为base64,那么引入图片需要如下:

    <img src="images/*_min.png">

    当然,会自动生成一份json文件,你也可以选择手动替换。

如有疑问或者有更好的idea,可以邮件我(daceyu@aliyun.com)一起探讨,谢谢!

About

Images are processed automatically, such as 1X, 2x, webp, Base64, etc. based on the requirements, and can also automatically turn the pictures on the page into Base64 format.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published