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
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
Inside Stream API
skrb
1
740
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
660
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
360
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
570
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
120
技術記事、AIに書かせるか、自分で書くか? 〜それでも私が自分の手で書く理由〜 / #QiitaConference
jnchito
2
1.4k
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.3k
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.6k
Contextとはなにか
chiroruxx
1
330
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
210
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
710
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
200
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
The SEO identity crisis: Don't let AI make you average
varn
0
490
Making Projects Easy
brettharned
120
6.7k
Agile that works and the tools we love
rasmusluckow
331
21k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Utilizing Notion as your number one productivity tool
mfonobong
4
320
Amusing Abliteration
ianozsvald
1
210
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