SlideShare a Scribd company logo
Jan Matuszewski
Rails Asset Pipeline in a
Nutshell
Purposes of Asset Pipeline
1. Serving assets to clients
How it’s done:
1. Move the assets to /public folder
2. Add <link rel="stylesheet" type="text/css" href=“style.css"> to <head>
3. Users download style.css for all pages
GET /index
GET /style.css
/index
/style.css
{Rails.root}/public/style.css
1.5. Caching
Serve asset only once, then use cache
GET /style.css
/style.css
Headers: Cache For 1 Week
100ms
GET /style.css
/style.css
0ms
2. Fingerprinting for cache invalidation
<link rel="stylesheet" href=“style-{checksum of file content}.css”>
GET /style-aaaa.css
/style-aaaa.css
Headers: Cache For 1 Week
100m
s
GET /style-aaaa.css
/style-aaaa.css
0ms
GET /style-bbbb.css
/style-bbbb.css
Headers: Cache For 1 Week
100ms
3. Transpiling
Change the format of delivered files into one recognised by browser
style.scss
Transpiler
style.css
Fingerprinting, Compression
Asset Pipeline
- Fingerprinting
- Concatenation
- Compression
- Source Maps
Sprockets:
Jsbundling-rails Cssbundling-rails Dartsass-rails Tailwindcss-rails
Transpiling
Rails 7 asset pipeline goals:
• Make it “Node-less” by default
• Stop using Sprockets for transpiling (prepare for Propshaft)
• Utilize HTTP/2
Dartsass
Rails
app/assets/stylesheets/style.scss app/assets/builds/style.css
Sprockets
public/assets/style-0a1b2c.css
Dart Sass Rails / TailwindCSS Rails CSS Bundling Rails
VS
Standalone Executable Versions
Node-less setup
Node transpiling
Importmaps = aliases?
Without npm or yarn
# config/importmap.rb
pin "vue", to: “https://ga.jspm.io/npm:vue@3.2.45/..."
// application.js
import Vue from "vue"
Allows you to use
My takeaways
For learning:
• Read all README’s
• Reading the setup code(lib/setup folder)
• Give thumbs on New Documentation
Thank you!
Jan Matuszewski
jmatuszewski.com

More Related Content

Similar to Rails 7 Asset Pipeline in a Nutshell

Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcSuman KC
 
Next Steps in Responsive Design
Next Steps in Responsive DesignNext Steps in Responsive Design
Next Steps in Responsive DesignJustin Avery
 
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...Inexture Solutions
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalDaniel Downs
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimizationpaudelvinay
 
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10Pro Magento Community
 
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!Stefan Bauer
 
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptxIntroduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptxIlesh Mistry
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simpleJagadishBabuParri
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013Bastian Grimm
 
cascading style sheet(css).pptx
cascading style sheet(css).pptxcascading style sheet(css).pptx
cascading style sheet(css).pptxSuhaibKhan62
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfRonDosh
 
Speed Up Your Website
Speed Up Your WebsiteSpeed Up Your Website
Speed Up Your WebsiteAnupom Syam
 
A11y Conference Talk: Building an Accessible WordPress Theme
A11y Conference Talk: Building an Accessible WordPress ThemeA11y Conference Talk: Building an Accessible WordPress Theme
A11y Conference Talk: Building an Accessible WordPress ThemeTomAuger
 
46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello worldhemi46h
 
Analysis of Google Page Speed Insight
Analysis of Google Page Speed InsightAnalysis of Google Page Speed Insight
Analysis of Google Page Speed InsightSarvesh Sonawane
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer NotesVskills
 

Similar to Rails 7 Asset Pipeline in a Nutshell (20)

Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kc
 
Next Steps in Responsive Design
Next Steps in Responsive DesignNext Steps in Responsive Design
Next Steps in Responsive Design
 
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...
A Comprehensive Guide on Building Lightning-Fast Websites with React Static S...
 
Creating a web gallery lightbox2 final
Creating a web gallery lightbox2 finalCreating a web gallery lightbox2 final
Creating a web gallery lightbox2 final
 
Wordpress optimization
Wordpress optimizationWordpress optimization
Wordpress optimization
 
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10
Ways to keep it fun with Hyva Themes, Alex Galdin - Pro Magento Meetup #10
 
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
SPS Oslo - Stop your SharePoint CSS becoming a di-sass-ter today!
 
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptxIntroduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
Introduction to Tailwind CSS - IM Tech Meetup - May 2022.pptx
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 
Teched Inetrgation ppt and lering in simple
Teched Inetrgation ppt  and lering in simpleTeched Inetrgation ppt  and lering in simple
Teched Inetrgation ppt and lering in simple
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
cascading style sheet(css).pptx
cascading style sheet(css).pptxcascading style sheet(css).pptx
cascading style sheet(css).pptx
 
Get Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdfGet Started With Tailwind React and Create Beautiful Apps.pdf
Get Started With Tailwind React and Create Beautiful Apps.pdf
 
Speed Up Your Website
Speed Up Your WebsiteSpeed Up Your Website
Speed Up Your Website
 
A11y Conference Talk: Building an Accessible WordPress Theme
A11y Conference Talk: Building an Accessible WordPress ThemeA11y Conference Talk: Building an Accessible WordPress Theme
A11y Conference Talk: Building an Accessible WordPress Theme
 
html5_css3
html5_css3html5_css3
html5_css3
 
46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world46h interaction 1.lesson Hello world
46h interaction 1.lesson Hello world
 
Analysis of Google Page Speed Insight
Analysis of Google Page Speed InsightAnalysis of Google Page Speed Insight
Analysis of Google Page Speed Insight
 
Css
CssCss
Css
 
Vskills certified css designer Notes
Vskills certified css designer NotesVskills certified css designer Notes
Vskills certified css designer Notes
 

Recently uploaded

fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerapareshmondalnita
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edgePaco Orozco
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageRCC Institute of Information Technology
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectRased Khan
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdfKamal Acharya
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdfKamal Acharya
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxwendy cai
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfNurvisNavarroSanchez
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionjeevanprasad8
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxCenterEnamel
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwoodseandesed
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptssuser9bd3ba
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsAtif Razi
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234AafreenAbuthahir2
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdfKamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxViniHema
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringC Sai Kiran
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
 

Recently uploaded (20)

fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge2024 DevOps Pro Europe - Growing at the edge
2024 DevOps Pro Europe - Growing at the edge
 
Scaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltageScaling in conventional MOSFET for constant electric field and constant voltage
Scaling in conventional MOSFET for constant electric field and constant voltage
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
Hall booking system project report .pdf
Hall booking system project report  .pdfHall booking system project report  .pdf
Hall booking system project report .pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical SolutionsRS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
RS Khurmi Machine Design Clutch and Brake Exercise Numerical Solutions
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 

Rails 7 Asset Pipeline in a Nutshell