Build System 5 OO Design Principles Build System et cetera... Testing Logical File Organization Build System -style app/ controllers/ models/ et cetera... Saturday, June 23, 12
What Do Javascript Build Systems Do in the Real World? ■ Concatenation ■ Minification ■ Authoring in another language ■ Stripping asserts ■ Deferring parsing ■ Template compilation 7 Saturday, June 23, 12
The Metaphor: Pipes & Filters, a.k.a. Pipeline 10 Input Output Filter Filter Filter A bunch of JS files Wrap each file in a closure Minify each file Concatenate into a single file dist/application.js For example: Saturday, June 23, 12
History of rake-pipeline ■October, 2011 ■LivingSocial needs a solution to build an Ember.js project ■Yehuda Katz creates rake-pipeline ■Open-sourced soon after 14 Saturday, June 23, 12
“By modeling the problem as a build process, it’s easier to add new features and compose steps than by hardcoding different types of processors and hoping they all fit together.” Yehuda Katz 16 Saturday, June 23, 12
18 FIleTask is a Rake task designed to create a file. If a target file is newer than all its dependencies, the task action is not run. Saturday, June 23, 12
25 Pipeline DSL Input Output Filter Filter Filter A bunch of JS files Wrap each file in a closure Minify each file Concatenate into a single file dist/application.js Saturday, June 23, 12
26 Pipeline DSL Input Output Filter Filter Filter A bunch of JS files Wrap each file in a closure Minify each file Concatenate into a single file dist/application.js Saturday, June 23, 12
27 Pipeline DSL Output Filter Filter Filter Wrap each file in a closure Minify each file Concatenate into a single file dist/application.js Saturday, June 23, 12
29 Pipeline DSL Filter Filter Wrap each file in a closure Minify each file Filter Concatenate into a single file Output dist/application.js Saturday, June 23, 12
Integrating in Development Rake::Pipeline::Middleware ■ configure with an Assetfile Rake::Pipeline::Railtie ■ inserts Middleware in the right spot for Rails 41 Saturday, June 23, 12
Thanks! “Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy.” -Matz Follow me @lukemelia Some examples appear courtesy of my company, Yapp (which happens to be hiring, by the way). Creative Commons photo credits: flickr.com/photos/yuan2003/3872588071, flickr.com/photos/banjaxx/7121971091, flickr.com/photos/guy_on_the_streets/ 3034517059, flickr.com/photos/fbmore/1148889628, flickr.com/photos/serenitbee/7118733565, flickr.com/photos/stuckincustoms/524185543, flickr.com/photos/ nasa_jsc_photo/6993385964, flickr.com/photos/lukeredmond/2101713113, flickr.com/photos/numbphoto/7052838173, flickr.com/photos/thomasleuthard/ 5805008144, flickr.com/photos/tomvu/5081689621, flickr.com/photos/[email protected]/7401066082 42 Saturday, June 23, 12