Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
amp
Search
ararajp
February 02, 2017
Technology
200
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
amp
ararajp
February 02, 2017
More Decks by ararajp
See All by ararajp
genda-referral-hiring
ararajp
0
110
グループ会社を横断したエンジニア組織の立ち上げと挑戦/GENDA-org-2023
ararajp
1
850
iOSアプリのバッテリー消費を意識する/iosdc2020-ios-battery
ararajp
3
5.4k
zzt-meetup.pdf
ararajp
2
1.9k
ios_ci
ararajp
0
210
Other Decks in Technology
See All in Technology
Gen3R: 3D Scene Generation Meets Feed-Forward Reconstruction
spatial_ai_network
0
120
人を動かすのは時間ではなく、納得感 〜新任EMが入社3ヶ月、組織を2回変えた話〜
kakehashi
PRO
3
220
Amazon EVS で VCF 9.0 / 9.1 のサポート開始まとめ
mtoyoda
0
290
あなたの『Site』はどこですか? — xREという考え方
miyamu
0
1.2k
オブザーバビリティ、本当に活用できてる? 〜API連携×生成AIで成熟度を自動評価〜
dmmsre
1
3.1k
KiCAD講習会②
tutcreators
0
110
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
1
240
SRE本の知られざる名シーン / The Hidden Gems of Google SRE Book
nari_ex
1
380
個人開発で育てる「大規模設計の苗床」 - AI時代の1人開発から始める業務への知識接続 / The Seedbed for Large-Scale Design - From AI-Era Solo Projects to Professional Knowledge
bitkey
PRO
0
160
ボーイスカウトルールでメモリやスキルを改善しよう
azukiazusa1
1
830
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
2
1.5k
型は壁、Rustでもバグを直すな、表現できなくせよ
nwiizo
13
2k
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
330
Odyssey Design
rkendrick25
PRO
2
730
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
340
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
630
Raft: Consensus for Rubyists
vanstee
141
7.6k
Mind Mapping
helmedeiros
PRO
1
280
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
2
320
YesSQL, Process and Tooling at Scale
rocio
174
15k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Navigating Weather and Climate Data
rabernat
0
310
Transcript
RailsͰͷAMP࣮ࣄྫ
Profile ߥҪ ༐ี 2006-2011 Yahoo!JAPAN 2011- VASILY.inc ʮiQONʯͱ͍͏ঁੑ͚ϑΝογϣϯαʔϏεΛ࡞͍ͬͯ·͢ https://www.iqon.jp/ tech.vasily.jp/
AMPɹɹ Accelerated Mobile Pages
AMPͱ ϞόΠϧϖʔδΛߴʹϢʔβʔಧ͚ΔͨΊʹൃͨ͠ϓϩδΣΫτ
None
࣮ʹਏ੍͍͕͋Δ
• ඞਢϚʔΫΞοϓ͕ଟ͍ • ࡞ͨ͠JavaScriptېࢭ • ༻ҙ͞Ε͍ͯΔAMP ComponentΛ༻ • CSSheadλά͔StyleཁૉͰΠϯϥΠϯͷΈ •
linkཁૉcanonical͚ͩ ͳͲͳͲ...
ݫ͍݅͠ԼͰखͬऔΓૣ͘Rails Ͱ࣮͠·͠ΐ͏
• routing • Controller • View • CSS
routing ௨ৗϖʔδͷURLʹ/ampΛ͚ͨ͠αϒςΟϨΫτϦํࣜ https://item.iqon.jp/15011036 // ௨ৗϖʔδ https://item.iqon.jp/15011036/amp // AMPϖʔδ get '/:item_id/amp',
to: 'item#amp', constraints: {item_id: /[0-9]+/} ?amp=1 / .ampͰஅͳͲαʔϏε͝ͱʹ߹͕ྑ͍ͷʹ͠·͠ΐ͏ αϒυϝΠϯͰ͍͚·͢
Controller PC/ϞόΠϧͱڞ௨ͷॲཧͰcanonical͚ͩઃఆ AMP༻ͷviewͱlayoutͰϨϯμϦϯά def amp if _detail # PC/ϞόΠϧͳͲͱڞ௨ͷॲཧ @html[:canonical]
= "https://item.iqon.jp/#{@item[:item_id]}/" # ϞόΠϧϖʔδcanonical render 'item/amp/detail', layout: 'amp/layout' # AMP༻ͷৄࡉϖʔδͱϨΠΞτ end end def sp @html[:amphtml] = "https:#{domain_item}/#{@item[:item_id]}/amp/" if params[:amp].blank? end
View ෆཁͳίϯϙʔωϯτͷJSΛಡΈࠐΉͱܯࠂ͕ग़Δ JSͷಡΈࠐΈॱݫີʹܾ·͍ͬͯΔ layout # ڞ௨ͷAMP JSlayoutͰಡΈࠐΉ script async=true custom-element="amp-analytics"
src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js" = yield(:extended_component_tags) script async=true src='https://cdn.ampproject.org/v0.js' Template content_for :extended_component_tags do script async=true custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"
CSS <link rel="stylesheet" href="">ېࢭ͞Ε͍ͯΔ ViewͰCSSΛrender͠ͳ͍ͱ͍͚ͳ͍ গ͢͠ΕίϯύΠϧ͕ඞཁͳSassͰ͏͜ͱ͕Մೳ
Template ༻͢ΔsassΛࢦఆ content_for :css_path, 'item/amp/show.sass' layout render_cssͱ͍͏ϔϧύʔΛ༻ style amp-custom=true =
render_css(yield :css_path)
Helper RubyεΫϦϓτ෦ͰSCSSΛCSSʹม͢Δ def render_css path raw Sass::Engine.for_file("#{Rails.root}/app/assets/stylesheets/#{path}", { load_paths: ["#{Rails.root}/app/assets/stylesheets"],
#importͷج४path style: :compressed # ѹॖ }).to_css end
·ͱΊ • ੍ଟ͍͕͢ΕϞόΠϧ͔Βมߋ͕গͳͯ͘ࡁΉ • AMPಋೖ͕ਐΜͰ͍·͢ɻະରԠͷ߹ใΛूΊ·͠ΐ͏
None
͋Γ͕ͱ͏͍͟͝·ͨ͠