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
190
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
840
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
2026 TECHFRESH 畢業分享會 - 開發日常大解密!從領域驅動到企業級上線
line_developers_tw
PRO
0
1.2k
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
920
自律型AIエージェントは何を破壊するのか
kojira
0
160
手塩にかけりゃいいってもんじゃない
ming_ayami
0
600
AAIFに入ってみた ~内から見えるコミュニティ動向~
sato4
0
250
RAG を使わないという選択肢
tatsutaka
1
250
Kubernetesにおける学習基盤とLLMOpsの概要
ry
1
310
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
tomoki10
1
630
就職⽀援サービスにおけるキャリアアドバイザーのシフトスケジューリング
recruitengineers
PRO
1
150
200個のGitHubリポジトリを横断調査したかった
icck
0
130
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.2k
Agent Skills設計で柔軟性と硬さのバランスが難しい話
nassy20
0
130
Featured
See All Featured
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
How to Think Like a Performance Engineer
csswizardry
28
2.7k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
250
Practical Orchestrator
shlominoach
191
11k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Why Our Code Smells
bkeepers
PRO
340
58k
First, design no harm
axbom
PRO
2
1.2k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
250
Technical Leadership for Architectural Decision Making
baasie
3
410
Embracing the Ebb and Flow
colly
88
5.1k
How to make the Groovebox
asonas
2
2.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠