1 of 29

前端流程解析

與響應式網頁設計基礎

Frontend Development Workflow and Responsive Web Design Fundamentals - Tutorial by Ying-Ray Lu

1

2 of 29

講者

Ying-Ray Lu

Full Stack Software Engineer - Mattel, Inc.

  • Developed and implemented web client using ES7, React, Redux, LESS, Webpack.
  • Wrote unit tests, e2e tests, api tests using Mocha, Jest for Behavior Driven Development.
  • Created a RESTful API endpoints using Node and Express, Java Servlet.
  • Deployed services using Docker, Ansible, SSH.
  • Implemented account system, social web application.
  • Added databases using MySQL, MS SQL, MongoDB.

Github: https://github.com/yingray | LinkedIn: https://tw.linkedin.com/in/yingraylu

2

3 of 29

大綱

  • 主題簡介
  • 前端流程解析
  • 什麼是響應式網頁設計(RWD)?
  • 網頁應用vs原生應用
  • 前端專用編譯器
  • 回顧一下基礎的layout
  • RWD三大核心:Media query, Flexible grid, View port
  • Programming Challenge
  • Bootstrap

3

4 of 29

前端工程師 Front-end Engineer (F2E)

什麼是前端?

我們這整堂培訓課程,跟前端有關嗎?

4

5 of 29

什麼是響應式網頁設計(RWD)?

5

來看看近代科技設計主流品牌:蘋果的官方網站

Apple - Website

6 of 29

原生應用

網頁應用

  • 硬體完整結合
  • 效能佳
  • 使用者體驗較優
  • 良好金流
  • 網路差或離線仍有良好操作
  • 成本預算低
  • 搜尋引擎最佳化
  • 減少不必要的審核流程
  • 更新頻繁
  • 跨平台

6

7 of 29

Web app 吸引到更多的用戶

7

8 of 29

Native app 平均使用時間大勝

8

9 of 29

前端專用編譯器

Sublime Text

Atom

Visual Studio Code

WebStorm / PhpStorm (JetBrains)

9

10 of 29

Sublime Text - Installation

  • Download installer: https://www.sublimetext.com
  • Install Package Control: https://packagecontrol.io/installation
  • Install plugins:
    • Emmet
    • Html-css-jss prettify

10

import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

11 of 29

回顧一下基礎的layout

11

12 of 29

CSS Layout

  • display
    • block
    • inline
    • inline-block
    • flex
    • inline-flex
    • grid
  • margin: 0 auto
  • max-width, min-width
  • box-sizing: ​border-box

12

  • position
    • ​static
    • relative
    • fixed
    • absolute
  • float
    • left
    • right
  • clear
    • left
    • right

13 of 29

RWD三大核心 - Media Query

13

@media screen and (max-width: 768px)

media type media feature

14 of 29

RWD三大核心 - Media Query

14

width: 0 - 768px

width: 769px up

15 of 29

RWD三大核心 - Flexible Grid

15

WEB

TABLET

MOBILE

16 of 29

RWD三大核心 - Flexible Grid

1.

2.

3.

4. 使用CSS framework

16

float: right;

display: inline-block;

display: flex/grid;

過去習慣上使用的方法

直覺、方便快速

較新、排版神技

17 of 29

RWD三大核心 - View port

  • width
  • initial-scale
  • minimum-scale
  • maximum-scale
  • user-scalable

17

<meta name="viewport" content="width=device-width, initial-scale=1">

18 of 29

Programming Challenge

18

19 of 29

| Bootstrap |

包含具現代感設計UI、行動裝置友善之響應設計、最熱門的WEB框架

19

20 of 29

等等,我們職訓不是後端的課嗎?

前端的框架對我們來說重要嗎?

Bootstrap其實更適合後端開發者:

  • 提供符合現代設計的UI
  • 良好的響應格線系統
  • 適當的媒體適應性
  • 簡易且堪用的互動、動畫

20

21 of 29

還記得重要的RWD三大核心嗎?

21

22 of 29

Bootstrap - Grid system

http://getbootstrap.com/css/#grid

進入官方網站,暸解Bootstrap的格線系統

22

23 of 29

Flexible grid - Bootstrap實作

23

24 of 29

New Semantic Elements in HTML5

Reference:

24

25 of 29

Wireframe and Flow Chart

25

26 of 29

Wireframe - Bootstrap實作

綜合 Flexible grid 和 語意化標籤 來實作一個簡易的RWD頁面。

26

27 of 29

27

28 of 29

Programming Challenge

28

29 of 29

結論與發問

老師,上完這堂課後,我想成為前端工程師了!有沒有什麼推薦的框架要學的?

基本功遠比你想像的重要。近年來前端領域有兩項特性及趨勢:

  • 瀏覽器引擎的強化,導致前端知識越來越深入,處理了更多的資料流,甚至近於後端的架構及設計
  • 前端的技術變化速度太快,今天推薦一個框架給你,可能明天就被取代了

紮實的基本功,甚至熟悉我們課程後端的知識,才能迅速地吸收新技術。

29