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
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
110
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
6.8k
生成AI時代にこそ効くGo | Why Go Works in the Age of Generative AI
mom0tomo
8
3.3k
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
260
ふつうのFeature Flag実践入門
irof
8
4k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.4k
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
540
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
6.7k
さぁV100、メモリをお食べ・・・
nilpe
0
140
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
260
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
660
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
160
Raft: Consensus for Rubyists
vanstee
141
7.5k
Building the Perfect Custom Keyboard
takai
2
800
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
200
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
Bash Introduction
62gerente
615
220k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
How to build a perfect <img>
jonoalderson
1
5.7k
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