Skip to content

Commit

Permalink
convert svg icon to base64 for better performance
Browse files Browse the repository at this point in the history
cythilya committed Aug 27, 2018
1 parent d33c3be commit db6b5bb
Showing 31 changed files with 350 additions and 46 deletions.
2 changes: 1 addition & 1 deletion assets/images/svg/crab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/svg/grill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/images/svg/logo-fff.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/svg/man-in-a-party-dancing-with-people.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/svg/noodles.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/images/svg/tray.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dist/images/sprite.symbol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dist/images/sprite.symbol.svg.br
Binary file not shown.
Binary file modified dist/images/sprite.symbol.svg.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<title>吃什麼,どっち</title>
<meta name="description" content="今天吃飯,該吃什麼好呢?只要輸入美食欲望,立刻給你最真實、現場、生活化的評價,找餐廳再也不煩惱,就讓吃什麼,どっち幫你決定吃什麼!">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="preload" href="/images/sprite.symbol.svg" type="image/svg+xml" crossorigin="anonymous">
<!-- <link rel="preload" href="/images/sprite.symbol.svg" type="image/svg+xml" crossorigin="anonymous"> -->
<link rel="preconnect" href="https://res.cloudinary.com">
<link rel="preconnect" href="https://firestore.googleapis.com">
<style>html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}</style>
Binary file modified dist/index.html.br
Binary file not shown.
Binary file modified dist/index.html.gz
Binary file not shown.
20 changes: 10 additions & 10 deletions dist/main-bundle.js

Large diffs are not rendered by default.

Binary file modified dist/main-bundle.js.br
Binary file not shown.
Binary file modified dist/main-bundle.js.gz
Binary file not shown.
25 changes: 21 additions & 4 deletions package-lock.json
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@
"optimize-css-assets-webpack-plugin": "^4.0.3",
"postcss": "^7.0.2",
"postcss-color-mod-function": "^2.4.3",
"postcss-extend-rule": "^2.0.0",
"postcss-loader": "^3.0.0",
"postcss-modules": "^1.3.2",
"precss": "^3.1.2",
1 change: 1 addition & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -10,5 +10,6 @@ module.exports = {
],
},
lost: {},
'postcss-extend-rule': {},
},
};
8 changes: 6 additions & 2 deletions src/components/footer.js
Original file line number Diff line number Diff line change
@@ -30,12 +30,16 @@ const Footer = () => {
title={item.title}
className="tag-list__item__link"
>
<Icon
<i
title={item.title}
className={`tag-list__item__icon icon-${item.className}`}
/>
{/* <Icon
name={item.className}
title={item.title}
size={50}
fill=""
/>
/> */}
<span
className="tag-list__item__title"
>
10 changes: 7 additions & 3 deletions src/components/header.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
import Icon from './icon';
// import Icon from './icon';
import '../../style/components/header.css';
import { common } from '../data/locale_tw';

@@ -12,12 +12,16 @@ const Header = () => {
to="/"
title={common.title}
>
<Icon
<i
styleName="header__logo header__logo__image"
className="icon-logo"
/>
{/* <Icon
name="logo"
className="header__logo"
title={common.title}
size={40}
/>
/> */}
</Link>
<Link
to="/"
4 changes: 2 additions & 2 deletions src/components/icon.js
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ const Icon = ({
inContent,
}) => {
const style = {
'marginRight': '10px',
'verticalAlign': 'middle',
marginRight: '10px',
verticalAlign: 'middle',
};

return (
3 changes: 3 additions & 0 deletions src/components/store_control_buttons.js
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ const StoreControlButtons = ({ store }) => {
<Icon
name="phone"
title={iconData.phoneBooking}
size="24"
/>
<span className="button-with-line-breaks-text">
{iconData.phoneBooking}
@@ -38,6 +39,7 @@ const StoreControlButtons = ({ store }) => {
<Icon
name="online-booking"
title={iconData.onlineBooking}
size="24"
/>
<span className="button-with-line-breaks-text">
{iconData.onlineBooking}
@@ -55,6 +57,7 @@ const StoreControlButtons = ({ store }) => {
<Icon
name="pin-on-map"
title={iconData.navigation}
size="24"
/>
<span className="button-with-line-breaks-text short-word">
{iconData.navigation}
49 changes: 37 additions & 12 deletions src/components/store_item.js
Original file line number Diff line number Diff line change
@@ -3,12 +3,12 @@ import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import LazyLoad from 'react-lazy-load';
import '../../style/components/store_item.css';
import Icon from './icon';
// import Icon from './icon';
import StoreControlButtons from './store_control_buttons';
import { icon as iconData } from '../data/locale_tw';

const StoreItem = ({ store }) => {
const iconColor = '#aaa';
// const iconColor = '#aaa';
const boxStyle = {
background: '#e8e8e8',
width: '175px',
@@ -56,13 +56,18 @@ const StoreItem = ({ store }) => {
</div>
<ul styleName="store-item__detail">
<li styleName="store-item__detail__item">
<Icon
<i
className="icon-pin-map"
styleName="store-item__detail__item__icon"
title={iconData.address}
/>
{/* <Icon
name="pin-map"
title={iconData.address}
size={14}
fill={iconColor}
inContent
/>
/> */}
<a
title={iconData.navigation}
href={`https://www.google.com.tw/maps/search/${store.location.address}`}
@@ -73,13 +78,18 @@ const StoreItem = ({ store }) => {
</a>
</li>
<li styleName="store-item__detail__item">
<Icon
<i
className="icon-phone"
styleName="store-item__detail__item__icon"
title={iconData.phone}
/>
{/* <Icon
name="phone"
title={iconData.phone}
size={14}
fill={iconColor}
inContent
/>
/> */}
<a
title={iconData.phone}
href={`${store.phone}`}
@@ -90,37 +100,52 @@ const StoreItem = ({ store }) => {
</a>
</li>
<li styleName="store-item__detail__item">
<Icon
<i
className="icon-clock-circular-outline"
styleName="store-item__detail__item__icon"
title={iconData.openingHour}
/>
{/* <Icon
name="clock-circular-outline"
title={iconData.openingHour}
size={14}
fill={iconColor}
inContent
/>
/> */}
{store.openingHour.start}
~
{store.openingHour.end}
</li>
<li styleName="store-item__detail__item">
<Icon
<i
className="icon-dollar"
styleName="store-item__detail__item__icon"
title={iconData.price}
/>
{/* <Icon
name="dollar"
title={iconData.price}
size={14}
fill={iconColor}
inContent
/>
/> */}
{store.price.lowest}
~
{store.price.highest}
</li>
<li styleName="store-item__detail__item">
<Icon
<i
className="icon-global"
styleName="store-item__detail__item__icon"
title={iconData.website}
/>
{/* <Icon
name="global"
title={iconData.website}
size={14}
fill={iconColor}
inContent
/>
/> */}
<Link
to={store.sns.website}
title={store.name}
10 changes: 7 additions & 3 deletions src/components/tag_list.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ import _ from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import Icon from './icon';
// import Icon from './icon';
import '../../style/components/tag_list.css';

const TagList = ({ tags }) => {
@@ -20,12 +20,16 @@ const TagList = ({ tags }) => {
title={item.title}
className="tag-list__item__link"
>
<Icon
<span
title={item.title}
className={`tag-list__item__icon icon-${item.className}`}
/>
{/* <Icon
name={item.className}
title={item.title}
size={50}
fill=""
/>
/> */}
<span
className="tag-list__item__title"
>
2 changes: 1 addition & 1 deletion src/index.ejs
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<title><%= htmlWebpackPlugin.options.title %></title>
<meta name="description" content="今天吃飯,該吃什麼好呢?只要輸入美食欲望,立刻給你最真實、現場、生活化的評價,找餐廳再也不煩惱,就讓吃什麼,どっち幫你決定吃什麼!">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<link rel="preload" href="/images/sprite.symbol.svg" type="image/svg+xml" crossorigin="anonymous">
<!-- <link rel="preload" href="/images/sprite.symbol.svg" type="image/svg+xml" crossorigin="anonymous"> -->
<link rel="preconnect" href="https://res.cloudinary.com">
<link rel="preconnect" href="https://firestore.googleapis.com">
<style>html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}</style>
9 changes: 8 additions & 1 deletion style/components/header.css
Original file line number Diff line number Diff line change
@@ -17,11 +17,18 @@
margin-right: 5px;
}

:global .header__logo {
:local .header__logo {
display: block;
margin: 0 15px 0 0;
}

/* base64 */
:local .header__logo__image {
display: block;
width: 40px;
height: 40px;
}

:local .header__title {
display: block;
font-size: 17px;
7 changes: 7 additions & 0 deletions style/components/store_item.css
Original file line number Diff line number Diff line change
@@ -46,6 +46,13 @@
}
}

:local .store-item__detail__item__icon {
display: inline-block;
width: 14px;
height: 14px;
margin-right: 10px;
}

:local .store-item__tag-list {
display: flex;
flex-wrap: wrap;
2 changes: 2 additions & 0 deletions style/components/tag_list.css
Original file line number Diff line number Diff line change
@@ -29,4 +29,6 @@

.tag-list__item__icon {
display: block;
width: 50px;
height: 50px;
}
1 change: 1 addition & 0 deletions style/generals/_generals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import 'global.css';
@import 'layout.css';
@import 'icon.css';
@import 'button.css';
227 changes: 227 additions & 0 deletions style/generals/icon.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion style/generals/sprites/symbol/svg/sprite.symbol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit db6b5bb

Please sign in to comment.