GithubHelp home page GithubHelp logo

superzdd / h5-img-tool Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 47 KB

手机 H5 项目中经常使用到的一些操作,比如图片批量 cdn,图片的宽高适配这些都将其自动化

JavaScript 100.00%

h5-img-tool's Introduction

手机 H5 项目通用小工具

手机 H5 项目中经常使用到的一些操作,比如图片批量 cdn,图片的宽高适配这些都将其自动化

img-css

将文件夹下的所有图片文件(包括子文件夹)批量生成宽高的对应 css 文件,生成的文件会在图片文件的根目录下,生成的文件如下:

  • app-percent-xxx.css 宽度使用%,高度使用calcvw的方式来计算,默认值为屏幕宽度永远为750px
  • app-rem-xxx.css 宽度高度都使用rem,默认值为屏幕宽度永远为7.5rem
  • app-rpx-xxx.css 宽度高度都使用rpx,默认值为屏幕宽度永远为750rpx

生成命令

node img-css.js

注意事项

  1. 图片文件名不要有重复,即使不在同一文件夹内也不要重复,否则会产生重复的 css 类
  2. 默认设计图的宽度为 750px,如果设计图宽度为 640 或其他值,则需要手动修改designPxWidth字段为相应的宽度

img-cdn

将文件夹下的所有图片文件进行 cdn 地址转换,生成的文件会在图片文件的根目录下,生成的文件如下:

  • cdn-all-xxx.js 所有图片的 cdn 路径

生成命令

node img-cdn.js

注意事项

  1. 这个 cdn 路径转换其实不会判断文件是不是图片类型,而是会把所有的文件都转化为 cdn 路径,如果有些文件不需要提交 cdn,请手动删除

h5-img-tool's People

Contributors

superzdd avatar

Watchers

 avatar

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.