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
860
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
Goでデータパイプラインを作ろう
sansantech
PRO
0
230
サイバー捜査員研修(後半)
nomizone
1
590
今こそ聞きたいソフトウェア設計 ドメイン駆動設計再入門
masuda220
PRO
16
5.5k
AI時代の強いチームの作り方
yuukiyo
23
15k
AIがAPIを書く時代に、私たちは何を設計すべきか
nagix
0
210
[ChatGPT Work LT]事務作業が苦手な人のための バックオフィスの「半」自動化
chimaki_iot
0
190
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1.2k
ラジオの科学
frievea
0
200
【Google Cloud Next Tokyo'26】Gemini Enterprise と Oracle AI Database で実現する、業務データ活用を実現する AI エージェント実装
shisyu_gaku
0
210
『三匹の子ぶた』から学ぶネットワークセキュリティの昔と今 / Network Security: Then and Now Through the Lens of The Three Little Pigs
nttcom
1
1.7k
【CEDEC2026】次世代デジタルカードゲームのサーバー設計と運用 〜『Shadowverse: Worlds Beyond』の舞台裏~
cygames
PRO
0
820
メルカリのグローバルアプリで挑んだ AlloyDB 運用と課題解決の実践記
hatappi
0
230
Featured
See All Featured
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
41k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
200
The SEO Collaboration Effect
kristinabergwall1
1
510
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
So, you think you're a good person
axbom
PRO
2
2.1k
The browser strikes back
jonoalderson
0
1.4k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
360
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
680
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
͋Γ͕ͱ͏͍͟͝·ͨ͠