diff --git a/.gitignore b/.gitignore index 40191fef..1b471430 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ node_modules CHANGELOG-GENERATED.md project.config.json +assets/icons/build +assets/icons/svg diff --git a/assets/icons/icons.sketch b/assets/icons/icons.sketch new file mode 100644 index 00000000..42985d06 Binary files /dev/null and b/assets/icons/icons.sketch differ diff --git a/bower.json b/bower.json index deb78ce8..44476c2b 100644 --- a/bower.json +++ b/bower.json @@ -13,8 +13,10 @@ "**/.*", "example", "build", + "assets", ".github", "app.*", - "*.md" + "*.md", + "*.log" ] } diff --git a/build/build-icon.sh b/build/build-icon.sh new file mode 100644 index 00000000..13770154 --- /dev/null +++ b/build/build-icon.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +basepath=$(dirname $0) +server_prefix=/zanui-weapp + +# convert relative path to absolute path +function abspath() { + pushd . > /dev/null; if [ -d "$1" ]; then cd "$1"; dirs -l +0; else cd "`dirname \"$1\"`"; cur_dir=`dirs -l +0`; if [ "$cur_dir" == "/" ]; then echo "$cur_dir`basename \"$1\"`"; else echo "$cur_dir/`basename \"$1\"`"; fi; fi; popd > /dev/null; +} + +command_exists () { + type "$1" >/dev/null 2>&1 +} + +fontname() { + echo "https://b.yzcdn.cn$server_prefix/$(basename $basepath/../assets/icons/build/font/zanui-weapp-icon-*.$1)" +} + +# generate font files from sketch file +$basepath/icons/extract-icons.sh +$basepath/icons/generate-font.sh + +if command_exists superman ; then + # upload to cdn + superman cdn $server_prefix $basepath/../assets/icons/build/font/zanui-weapp-icon-* +fi + +# generate fontface style +eot=$(fontname eot) +cat > $basepath/../dist/icon/index.wxss <> $basepath/../dist/icon/index.wxss diff --git a/build/icons/extract-icons.sh b/build/icons/extract-icons.sh new file mode 100755 index 00000000..ffcd05f7 --- /dev/null +++ b/build/icons/extract-icons.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +basepath=$(dirname $0) + +rm -rf $basepath/../../assets/icons/svg +sketchtool export slices --formats=svg --overwriting=YES --save-for-web=YES --output=$basepath/../../assets/icons/svg $basepath/../../assets/icons/icons.sketch diff --git a/build/icons/fount-config.js b/build/icons/fount-config.js new file mode 100644 index 00000000..033c64bb --- /dev/null +++ b/build/icons/fount-config.js @@ -0,0 +1,433 @@ +module.exports = { + name: 'zanui-weapp-icon', + output: '../../assets/icons/build', + meta: { + author: 'pangxie', + license: 'MIT', + license_url: 'https://opensource.org/licenses/MIT', + homepage: 'http://github.com/youzan', + css_prefix_text: 'zan-icon-', + filename_hash: true + }, + hinting: true, + glyphs_dir: '../../assets/icons/svg', + glyphs: [ + { + keywords: ['qr', 'invalid'], + src: '二维码失效.svg', + css: 'qr-invalid' + }, + { + keywords: ['qr'], + src: '二维码.svg', + css: 'qr' + }, + { + keywords: ['exchange'], + src: '兑换.svg', + css: 'exchange', + 'correct_contour_direction': true + }, + { + keywords: ['close'], + src: '关闭.svg', + css: 'close' + }, + { + keywords: ['location'], + src: '其他分店.svg', + css: 'location', + 'correct_contour_direction': true + }, + { + keywords: ['upgrade'], + src: '升级地址.svg', + css: 'upgrade' + }, + { + keywords: ['check'], + src: '单选.svg', + css: 'check' + }, + { + keywords: ['checked'], + src: '选中.svg', + css: 'checked' + }, + { + keywords: ['like', 'outline'], + src: '喜欢.svg', + css: 'like-o' + }, + { + keywords: ['like', 'filled'], + src: '喜欢2.svg', + css: 'like' + }, + { + keywords: ['chat'], + src: '客服.svg', + css: 'chat', + 'correct_contour_direction': true + }, + { + keywords: ['shop'], + src: '店铺.svg', + css: 'shop' + }, + { + keywords: ['photograph'], + src: '拍照.svg', + css: 'photograph' + }, + { + keywords: ['add'], + src: '新增地址.svg', + css: 'add' + }, + { + keywords: ['add2'], + src: '添加.svg', + css: 'add2' + }, + { + keywords: ['photo'], + src: '照片.svg', + css: 'photo' + }, + { + keywords: ['logistics'], + src: '物流.svg', + css: 'logistics', + 'correct_contour_direction': true + }, + { + keywords: ['edit'], + src: '编辑地址.svg', + css: 'edit' + }, + { + keywords: ['passed'], + src: '认证通过.svg', + css: 'passed' + }, + { + keywords: ['shopping-cart'], + src: '购物车2.svg', + css: 'shopping-cart' + }, + { + keywords: ['arrow'], + src: '进入箭头.svg', + css: 'arrow' + }, + { + keywords: ['gift'], + src: '送礼.svg', + css: 'gift' + }, + { + keywords: ['search'], + src: '搜索.svg', + css: 'search' + }, + { + keywords: ['clear'], + src: '清除搜索.svg', + css: 'clear' + }, + { + keywords: ['success'], + src: '成功.svg', + css: 'success' + }, + { + keywords: ['fail'], + src: '失败.svg', + css: 'fail' + }, + { + keywords: ['contact'], + src: '联系人.svg', + css: 'contact', + 'correct_contour_direction': true + }, + { + keywords: ['wechat'], + src: '微信支付.svg', + css: 'wechat' + }, + { + keywords: ['alipay'], + src: '支付宝支付.svg', + css: 'alipay' + }, + { + keywords: ['password', 'view'], + src: '密码可见.svg', + css: 'password-view' + }, + { + keywords: ['password', 'not', 'view'], + src: '密码不见.svg', + css: 'password-not-view' + }, + { + keywords: ['wap', 'nav'], + src: 'wap导航.svg', + css: 'wap-nav' + }, + { + keywords: ['wap', 'home'], + src: 'wap首页.svg', + css: 'wap-home' + }, + { + keywords: ['ecard', 'pay'], + src: '有赞E卡.svg', + css: 'ecard-pay', + 'correct_contour_direction': true + }, + { + keywords: ['balance', 'pay'], + src: '余额支付.svg', + css: 'balance-pay' + }, + { + keywords: ['peer', 'pay'], + src: '找人代付.svg', + css: 'peer-pay' + }, + { + keywords: ['credit', 'pay'], + src: '信用卡支付.svg', + css: 'credit-pay' + }, + { + keywords: ['debit', 'pay'], + src: '借记卡支付.svg', + css: 'debit-pay' + }, + { + keywords: ['other', 'pay'], + src: '其他支付方式.svg', + css: 'other-pay' + }, + { + keywords: ['cart'], + src: '购物车.svg', + css: 'cart' + }, + { + keywords: ['browsing', 'history'], + src: '浏览记录.svg', + css: 'browsing-history' + }, + { + keywords: ['goods', 'collect'], + src: '商品收藏.svg', + css: 'goods-collect' + }, + { + keywords: ['shop', 'collect'], + src: '店铺收藏.svg', + css: 'shop-collect' + }, + { + keywords: ['receive', 'gift'], + src: '收礼物.svg', + css: 'receive-gift', + 'correct_contour_direction': true + }, + { + keywords: ['send', 'gift'], + src: '送出赠品.svg', + css: 'send-gift' + }, + { + keywords: ['setting'], + src: '设置.svg', + css: 'setting' + }, + { + keywords: ['points'], + src: '积分.svg', + css: 'points' + }, + { + keywords: ['coupon'], + src: '优惠券.svg', + css: 'coupon' + }, + { + keywords: ['free', 'postage'], + src: '包邮.svg', + css: 'free-postage' + }, + { + keywords: ['discount'], + src: '折扣.svg', + css: 'discount' + }, + { + keywords: ['birthday', 'privilege'], + src: '生日特权.svg', + css: 'birthday-privilege' + }, + { + keywords: ['member', 'day', 'privilege'], + src: '会员日特权.svg', + css: 'member-day-privilege' + }, + { + keywords: ['balance', 'details'], + src: '余额明细.svg', + css: 'balance-details' + }, + { + keywords: ['cash', 'back', 'record'], + src: '返现记录.svg', + css: 'cash-back-record' + }, + { + keywords: ['points', 'mall'], + src: '积分商城.svg', + css: 'points-mall' + }, + { + keywords: ['exchange', 'record'], + src: '兑换记录.svg', + css: 'exchange-record' + }, + { + keywords: ['pending', 'payment'], + src: '待付款.svg', + css: 'pending-payment' + }, + { + keywords: ['pending', 'orders'], + src: '待接单.svg', + css: 'pending-orders' + }, + { + keywords: ['pending', 'deliver'], + src: '待发货.svg', + css: 'pending-deliver' + }, + { + keywords: ['pending', 'evaluate'], + src: '待评价.svg', + css: 'pending-evaluate' + }, + { + keywords: ['gift', 'card', 'pay'], + src: '礼品卡支付.svg', + css: 'gift-card-pay' + }, + { + keywords: ['cash', 'on', 'deliver'], + src: '货到付款.svg', + css: 'cash-on-deliver' + }, + { + keywords: ['underway'], + src: '进行中.svg', + css: 'underway' + }, + { + keywords: ['point', 'gift'], + src: '积分礼包.svg', + css: 'point-gift' + }, + { + keywords: ['after', 'sale'], + src: '售后.svg', + css: 'after-sale' + }, + { + keywords: ['edit', 'data'], + src: '编辑资料.svg', + css: 'edit-data' + }, + { + keywords: ['question'], + src: '答疑.svg', + css: 'question' + }, + { + keywords: ['delete'], + src: '删除.svg', + css: 'delete' + }, + { + keywords: ['records'], + src: '记录.svg', + css: 'records' + }, + { + keywords: ['description'], + src: '描述.svg', + css: 'description' + }, + { + keywords: ['card'], + src: '卡.svg', + css: 'card' + }, + { + keywords: ['gift', 'card'], + src: '礼卡.svg', + css: 'gift-card' + }, + { + keywords: ['coupon'], + src: '优惠券卡.svg', + css: 'coupon' + }, + { + keywords: ['clock'], + src: '时钟.svg', + css: 'clock' + }, + { + keywords: ['gold-coin'], + src: '金币.svg', + css: 'gold-coin' + }, + { + keywords: ['completed'], + src: '已完成.svg', + css: 'completed' + }, + { + keywords: ['value-card'], + src: '会员余额.svg', + css: 'value-card' + }, + { + keywords: ['certificate'], + src: '认证.svg', + css: 'certificate' + }, + { + keywords: ['tosend'], + src: '待发货2.svg', + css: 'tosend' + }, + { + keywords: ['sign'], + src: '已完成2.svg', + css: 'sign' + }, + { + keywords: ['home'], + src: '首页.svg', + css: 'home' + }, + { + keywords: ['phone'], + src: '电话.svg', + css: 'phone' + } + ] +}; diff --git a/build/icons/generate-font.sh b/build/icons/generate-font.sh new file mode 100755 index 00000000..bd1421ec --- /dev/null +++ b/build/icons/generate-font.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +basepath=$(dirname $0) + +iconfount --config $basepath/fount-config.js diff --git a/dist/icon/index.wxss b/dist/icon/index.wxss index 4d8b6bfc..8f83272a 100644 --- a/dist/icon/index.wxss +++ b/dist/icon/index.wxss @@ -1,19 +1,19 @@ /* DO NOT EDIT! Generated by fount */ @font-face { - font-family: 'zuiicon'; - src: url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.eot'); - src: url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.eot?#iefix') format('embedded-opentype'), - url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.woff2') format('woff2'), - url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.woff') format('woff'), - url('https://b.yzcdn.cn/zui/font/zuiicon-b37948cf5d.ttf') format('truetype') + font-family: 'zanui-weapp-icon'; + src: url('https://b.yzcdn.cn/zanui-weapp/zanui-weapp-icon-9e9804afef.eot'); + src: url('https://b.yzcdn.cn/zanui-weapp/zanui-weapp-icon-9e9804afef.eot?#iefix') format('embedded-opentype'), + url('https://b.yzcdn.cn/zanui-weapp/zanui-weapp-icon-9e9804afef.woff2') format('woff2'), + url('https://b.yzcdn.cn/zanui-weapp/zanui-weapp-icon-9e9804afef.woff') format('woff'), + url('https://b.yzcdn.cn/zanui-weapp/zanui-weapp-icon-9e9804afef.ttf') format('truetype') } .zan-icon { display: inline-block; } .zan-icon::before { - font-family: "zuiicon" !important; + font-family: "zanui-weapp-icon" !important; font-style: normal; font-weight: normal; speak: none; @@ -39,28 +39,92 @@ /* Font smoothing. That was taken from TWBS */ -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; /* Uncomment for 3D effect */ /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */ } -/* DO NOT EDIT! Generated by fount */ +/* DO NOT EDIT! Generated by iconfount */ -.zan-icon-album:before { content: '\e800'; } /* '' */ -.zan-icon-arrow:before { content: '\e801'; } /* '' */ -.zan-icon-camera:before { content: '\e802'; } /* '' */ -.zan-icon-certificate:before { content: '\e803'; } /* '' */ -.zan-icon-check:before { content: '\e804'; } /* '' */ -.zan-icon-checked:before { content: '\e805'; } /* '' */ -.zan-icon-close:before { content: '\e806'; } /* '' */ -.zan-icon-gift:before { content: '\e807'; } /* '' */ -.zan-icon-home:before { content: '\e808'; } /* '' */ -.zan-icon-location:before { content: '\e809'; } /* '' */ -.zan-icon-message:before { content: '\e80a'; } /* '' */ -.zan-icon-send:before { content: '\e80b'; } /* '' */ -.zan-icon-shopping-cart:before { content: '\e80c'; } /* '' */ -.zan-icon-sign:before { content: '\e80d'; } /* '' */ -.zan-icon-store:before { content: '\e80e'; } /* '' */ -.zan-icon-topay:before { content: '\e80f'; } /* '' */ -.zan-icon-tosend:before { content: '\e810'; } /* '' */ +.zan-icon-qr-invalid:before { content: '\e800'; } /* '' */ +.zan-icon-qr:before { content: '\e801'; } /* '' */ +.zan-icon-exchange:before { content: '\e802'; } /* '' */ +.zan-icon-close:before { content: '\e803'; } /* '' */ +.zan-icon-location:before { content: '\e804'; } /* '' */ +.zan-icon-upgrade:before { content: '\e805'; } /* '' */ +.zan-icon-check:before { content: '\e806'; } /* '' */ +.zan-icon-checked:before { content: '\e807'; } /* '' */ +.zan-icon-like-o:before { content: '\e808'; } /* '' */ +.zan-icon-like:before { content: '\e809'; } /* '' */ +.zan-icon-chat:before { content: '\e80a'; } /* '' */ +.zan-icon-shop:before { content: '\e80b'; } /* '' */ +.zan-icon-photograph:before { content: '\e80c'; } /* '' */ +.zan-icon-add:before { content: '\e80d'; } /* '' */ +.zan-icon-add2:before { content: '\e80e'; } /* '' */ +.zan-icon-photo:before { content: '\e80f'; } /* '' */ +.zan-icon-logistics:before { content: '\e810'; } /* '' */ +.zan-icon-edit:before { content: '\e811'; } /* '' */ +.zan-icon-passed:before { content: '\e812'; } /* '' */ +.zan-icon-shopping-cart:before { content: '\e813'; } /* '' */ +.zan-icon-arrow:before { content: '\e814'; } /* '' */ +.zan-icon-gift:before { content: '\e815'; } /* '' */ +.zan-icon-search:before { content: '\e816'; } /* '' */ +.zan-icon-clear:before { content: '\e817'; } /* '' */ +.zan-icon-success:before { content: '\e818'; } /* '' */ +.zan-icon-fail:before { content: '\e819'; } /* '' */ +.zan-icon-contact:before { content: '\e81a'; } /* '' */ +.zan-icon-wechat:before { content: '\e81b'; } /* '' */ +.zan-icon-alipay:before { content: '\e81c'; } /* '' */ +.zan-icon-password-view:before { content: '\e81d'; } /* '' */ +.zan-icon-password-not-view:before { content: '\e81e'; } /* '' */ +.zan-icon-wap-nav:before { content: '\e81f'; } /* '' */ +.zan-icon-wap-home:before { content: '\e820'; } /* '' */ +.zan-icon-ecard-pay:before { content: '\e821'; } /* '' */ +.zan-icon-balance-pay:before { content: '\e822'; } /* '' */ +.zan-icon-peer-pay:before { content: '\e823'; } /* '' */ +.zan-icon-credit-pay:before { content: '\e824'; } /* '' */ +.zan-icon-debit-pay:before { content: '\e825'; } /* '' */ +.zan-icon-other-pay:before { content: '\e826'; } /* '' */ +.zan-icon-cart:before { content: '\e827'; } /* '' */ +.zan-icon-browsing-history:before { content: '\e828'; } /* '' */ +.zan-icon-goods-collect:before { content: '\e829'; } /* '' */ +.zan-icon-shop-collect:before { content: '\e82a'; } /* '' */ +.zan-icon-receive-gift:before { content: '\e82b'; } /* '' */ +.zan-icon-send-gift:before { content: '\e82c'; } /* '' */ +.zan-icon-setting:before { content: '\e82d'; } /* '' */ +.zan-icon-points:before { content: '\e82e'; } /* '' */ +.zan-icon-coupon:before { content: '\e82f'; } /* '' */ +.zan-icon-free-postage:before { content: '\e830'; } /* '' */ +.zan-icon-discount:before { content: '\e831'; } /* '' */ +.zan-icon-birthday-privilege:before { content: '\e832'; } /* '' */ +.zan-icon-member-day-privilege:before { content: '\e833'; } /* '' */ +.zan-icon-balance-details:before { content: '\e834'; } /* '' */ +.zan-icon-cash-back-record:before { content: '\e835'; } /* '' */ +.zan-icon-points-mall:before { content: '\e836'; } /* '' */ +.zan-icon-exchange-record:before { content: '\e837'; } /* '' */ +.zan-icon-pending-payment:before { content: '\e838'; } /* '' */ +.zan-icon-pending-orders:before { content: '\e839'; } /* '' */ +.zan-icon-pending-deliver:before { content: '\e83a'; } /* '' */ +.zan-icon-pending-evaluate:before { content: '\e83b'; } /* '' */ +.zan-icon-gift-card-pay:before { content: '\e83c'; } /* '' */ +.zan-icon-cash-on-deliver:before { content: '\e83d'; } /* '' */ +.zan-icon-underway:before { content: '\e83e'; } /* '' */ +.zan-icon-point-gift:before { content: '\e83f'; } /* '' */ +.zan-icon-after-sale:before { content: '\e840'; } /* '' */ +.zan-icon-edit-data:before { content: '\e841'; } /* '' */ +.zan-icon-question:before { content: '\e842'; } /* '' */ +.zan-icon-delete:before { content: '\e843'; } /* '' */ +.zan-icon-records:before { content: '\e844'; } /* '' */ +.zan-icon-description:before { content: '\e845'; } /* '' */ +.zan-icon-card:before { content: '\e846'; } /* '' */ +.zan-icon-gift-card:before { content: '\e847'; } /* '' */ +.zan-icon-coupon:before { content: '\e848'; } /* '' */ +.zan-icon-clock:before { content: '\e849'; } /* '' */ +.zan-icon-gold-coin:before { content: '\e84a'; } /* '' */ +.zan-icon-completed:before { content: '\e84b'; } /* '' */ +.zan-icon-value-card:before { content: '\e84c'; } /* '' */ +.zan-icon-certificate:before { content: '\e84d'; } /* '' */ +.zan-icon-tosend:before { content: '\e84e'; } /* '' */ +.zan-icon-sign:before { content: '\e84f'; } /* '' */ +.zan-icon-home:before { content: '\e850'; } /* '' */ +.zan-icon-phone:before { content: '\e851'; } /* '' */ \ No newline at end of file diff --git a/example/icon/index.js b/example/icon/index.js index 742126d8..bbf4e8f4 100644 --- a/example/icon/index.js +++ b/example/icon/index.js @@ -1,23 +1,88 @@ Page({ data: { icons: [ - 'album', - 'arrow', - 'camera', - 'certificate', + 'close', + 'location', + 'clock', + 'gold-coin', + 'chat', + 'exchange', + 'upgrade', + 'edit', + 'contact', + 'passed', + 'points', + 'delete', + 'records', + 'logistics', 'check', 'checked', - 'close', 'gift', - 'home', - 'location', - 'message', - 'send', + 'like-o', + 'like', + 'qr', + 'qr-invalid', + 'shop', + 'photograph', + 'add', + 'add2', + 'photo', + 'cart', + 'arrow', + 'search', + 'clear', + 'success', + 'fail', + 'wechat', + 'alipay', + 'password-view', + 'wap-nav', + 'password-not-view', + 'wap-home', + 'ecard-pay', + 'balance-pay', + 'peer-pay', + 'credit-pay', + 'debit-pay', + 'other-pay', 'shopping-cart', + 'browsing-history', + 'goods-collect', + 'shop-collect', + 'receive-gift', + 'send-gift', + 'setting', + 'coupon', + 'free-postage', + 'discount', + 'birthday-privilege', + 'member-day-privilege', + 'balance-details', + 'cash-back-record', + 'points-mall', + 'exchange-record', + 'pending-payment', + 'pending-orders', + 'pending-deliver', + 'pending-evaluate', + 'cash-on-deliver', + 'gift-card-pay', + 'underway', + 'point-gift', + 'after-sale', + 'edit-data', + 'question', + 'description', + 'card', + 'gift-card', + 'coupon', + 'completed', + 'value-card', + 'certificate', + 'tosend', 'sign', - 'store', - 'topay', - 'tosend' + 'home', + 'phone' ] } }); diff --git a/example/icon/index.wxml b/example/icon/index.wxml index 294a3edd..c3e69239 100644 --- a/example/icon/index.wxml +++ b/example/icon/index.wxml @@ -8,10 +8,4 @@ zan-icon-{{ icon }} - - - - zan-icon-{{ icon }} - - diff --git a/package.json b/package.json index 17d2aa13..67bc8fe6 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ }, "scripts": { "release": "sh build/release.sh", - "changelog": "sh build/build-changelog.sh" + "changelog": "sh build/build-changelog.sh", + "icon": "sh build/build-icon.sh" }, "repository": { "type": "git",