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
React & ES6 with Sprockets
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
yachibit
June 04, 2015
Programming
6.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
React & ES6 with Sprockets
yachibit
June 04, 2015
More Decks by yachibit
See All by yachibit
もしgroovesのPMが ドラッカーの 『マネジメント』を読んだら
yachibit
0
230
Rails and Rack
yachibit
0
130
社会人になってから大学院でUXを学んでいる話
yachibit
0
790
エンジニアが人間中心設計をやってみた/engineer-challenged-hcd
yachibit
3
5.1k
Other Decks in Programming
See All in Programming
VibeCodingからAgenticWorkflowへ
starfish719
0
300
その節約、円になってますか?
isamumumu
1
700
「人を評価する AI」の設計と実装
ryoyanara
0
170
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
460
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
200
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
580
AIが無かった頃の素敵な出会いの話
codmoninc
1
390
源内ハンズオン概要編
hideg
0
120
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
330
霧の中の代数的エフェクト
funnyycat
1
480
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
580
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
110
Featured
See All Featured
A Soul's Torment
seathinner
6
3.4k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
400
Designing Experiences People Love
moore
143
24k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
470
Measuring & Analyzing Core Web Vitals
bluesmoon
9
950
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
170
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
56k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
160
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
540
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.5k
30 Presentation Tips
portentint
PRO
1
360
Transcript
React & ES6! with Sprockets Omote-sando.rb #1 June 4, 2015
by @yachibit
me • name: ୩ ༞ଠ (Yuta Yachi) • id: yachibit
• founder: Omote-sando.rb • company: Grooves Inc. • love: :beers:
None
Today’s Goal • Want to use ES6 !! • Want
to use browserify !!!! • Server-side rendering for SEO • Manage JS libraries with npm & gulp • Keep features of Assets-pipeline
Sprockets • Dependencies management of JS and CSS • Transpile
altJS • Minify & compress assets • Inserts an MD5 fingerprint into each filename
Cons of Sprockets • Depend on a library version of
gem • Not good compatible with JS ecosystem • browserify, babel, power-assert, jade …
Pros of Sprockets • Assets are served as separate filesʢin
developmentʣ • Responds with a new compiled file If files have changed • Invalidate caches by altering MD5 fingerprint
Use React & ES6 with Sprockets
Use React & ES6 with Sprockets • 1. Write JSX
with ES6. e.g. `frontend/javascripts/` • 2. Transpile with gulp & babel • 3. Place transpiled files in `app/assets/javascrips/ components` • 4. Process with Sprockets
gulpfile.coffee
Why use react-rails?
Why use react-rails? • Server-side rendering • `react_component` helper •
easily to use `renderToString` in Rails Views
Sample • https://github.com/yachibit-sandbox/ react_with_rails_and_gulp
THX :beers:
Refs • RailsGuides - The Asset Pipeline • http://guides.rubyonrails.org/asset_pipeline.html •
Sprockets࠶ߟ ϞμϯͳJSͷΤίγεςϜͱRailsͷΑΓྑ͍ؔΛ୳͢ • http://qiita.com/joker1007/items/9068e223744b3ac8c6dd • RailsͰࡢࠓͷJSͷΤίγεςϜ(gulpͱ͔ͦ͏͍͏ͷ)Λ͏ʹ͋ͨͬͯ͜ͷΑ͏ʹͨ͠ͱ͍͏ϝϞ • http://qiita.com/oreshinya/items/3d025dde2edc56622cc4 • 3 ways to integrate Ruby on Rails + React + Flux • http://www.openmindedinnovations.com/blogs/3-ways-to-integrate-ruby-on-rails-react-flux • Gulp on Rails: Replacing the Asset Pipeline • http://viget.com/extend/gulp-rails-asset-pipeline
Refs • Gulp - a modern approach to asset pipeline
for Rails developers • http://blog.arkency.com/2015/03/gulp-modern-approach-to-asset-pipeline-for-rails-developers • Rails, React, Browserify - Packaging your React components • https://medium.com/@olance/rails-react-browserify-e315001d5974 • Can't render browserified JS on server side #181 • https://github.com/reactjs/react-rails/issues/18 • ͳͥ(2015ͷϑϩϯτΤϯυͰɺmakeͰͳ͘)gulpΛબͿͷ͔ • http://mizchi.hatenablog.com/entry/2015/05/11/182118 • npm ͰґଘλεΫҰݩԽ͢Δ • http://qiita.com/Jxck_/items/efaff21b977ddc782971