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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
ADDF - ループエンジニアリングするフレームワークを作ったら/I Didn't Set Out to Build Loop Engineering, But ADDF Did
fruitriin
0
120
関数型の考えを TypeScript に持ち込んで、テストしやすい純粋関数を増やす / Pure at the Core, Effects at the Edge: Bringing Functional Thinking into TypeScript
kaminashi
1
110
Devsumi 2026 Summer 人もAIも使える共通基盤を事業の加速装置にする~デザインシステム運用に学ぶ組織レバレッジ~ 渡辺 凌央
legalontechnologies
PRO
0
100
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
1
290
インフラと開発の垣根を超えていき!〜元AWSインフラエンジニアがAWS開発で奮闘している話〜
hatahata021
1
170
GuardrailからGovernanceへ~AIエージェント運用の次の課題~
sbspsy
2
270
個人開発で育てる「大規模設計の苗床」 - AI時代の1人開発から始める業務への知識接続 / The Seedbed for Large-Scale Design - From AI-Era Solo Projects to Professional Knowledge
bitkey
PRO
0
160
ボーイスカウトルールでメモリやスキルを改善しよう
azukiazusa1
1
790
Keeping applications secure by evolving OAuth 2.0 and OpenID Connect
ahus1
PRO
1
160
完全自律ロボットを作りたくて、先に開発を自律させた話(ROS Japan UG #63 LT)
rryz09
0
500
Empower GenAI with Agile - あなたのアジャイルが生成AIのバフになる仕組み
hageyahhoo
1
180
SREとQA 二人三脚で進めるSLO運用/sre-qa-slo
sugitak
0
460
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
Technical Leadership for Architectural Decision Making
baasie
3
440
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
210
Context Engineering - Making Every Token Count
addyosmani
9
1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
230
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
270
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Side Projects
sachag
455
43k
For a Future-Friendly Web
brad_frost
183
10k
Ethics towards AI in product and experience design
skipperchong
2
330
Producing Creativity
orderedlist
PRO
348
40k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠