Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Desmistificando o Asset Pipeline

Rondy Sousa
September 15, 2012

Desmistificando o Asset Pipeline

Rondy Sousa

September 15, 2012
Tweet

More Decks by Rondy Sousa

Other Decks in Programming

Transcript

  1. "44&51*1&-*/&
    desmistificando o
    Saturday, September 15, 12

    View full-size slide

  2. !3POEZ
    Saturday, September 15, 12

    View full-size slide

  3. Saturday, September 15, 12

    View full-size slide

  4. Saturday, September 15, 12

    View full-size slide

  5. Saturday, September 15, 12

    View full-size slide

  6. "(&/%"
    Saturday, September 15, 12

    View full-size slide

  7. 1PSRVFQSFDJTÂWBNPT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  8. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  9. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  10. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    &YFD+4 UIFSVCZSBDFSFPVUSPTSVOUJNFT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  11. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    &YFD+4 UIFSVCZSBDFSFPVUSPTSVOUJNFT
    1SÉQSPDFTTBEPSFTDVTUPNJ[BEPT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  12. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    &YFD+4 UIFSVCZSBDFSFPVUSPTSVOUJNFT
    1SÉQSPDFTTBEPSFTDVTUPNJ[BEPT
    (FNJpDBOEPBTTFUTSFVTÂWFJT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  13. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    &YFD+4 UIFSVCZSBDFSFPVUSPTSVOUJNFT
    1SÉQSPDFTTBEPSFTDVTUPNJ[BEPT
    (FNJpDBOEPBTTFUTSFVTÂWFJT
    %JDBT USVRVFTFPVUSBTGFJUJÇBSJBT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  14. 1PSRVFQSFDJTÂWBNPT
    0WFSWJFX
    4QSPDLFUT
    &YFD+4 UIFSVCZSBDFSFPVUSPTSVOUJNFT
    1SÉQSPDFTTBEPSFTDVTUPNJ[BEPT
    (FNJpDBOEPBTTFUTSFVTÂWFJT
    %JDBT USVRVFTFPVUSBTGFJUJÇBSJBT
    "MUFSOBUJWBT
    "(&/%"
    Saturday, September 15, 12

    View full-size slide

  15. Saturday, September 15, 12

    View full-size slide

  16. 3"*-4¬36#:
    Saturday, September 15, 12

    View full-size slide

  17. 3"*-4¬36#:
    '0$0/0%0.°/*0%0130#-&."
    Saturday, September 15, 12

    View full-size slide

  18. 3"*-4¬36#:
    '0$0/0%0.°/*0%0130#-&."
    $0/7&/ª§040#3&$0/'*(63"ª§0
    Saturday, September 15, 12

    View full-size slide

  19. 3"*-4¬36#:
    '0$0/0%0.°/*0%0130#-&."
    $0/7&/ª§040#3&$0/'*(63"ª§0
    1"55&3/4*.1-°$*504
    Saturday, September 15, 12

    View full-size slide

  20. 3"*-4¬36#:
    '0$0/0%0.°/*0%0130#-&."
    $0/7&/ª§040#3&$0/'*(63"ª§0
    1"55&3/4*.1-°$*504
    03("/*;"ª§0%&"326*704
    Saturday, September 15, 12

    View full-size slide

  21. &0/%&&6(6"3%0
    04.&64"44&54
    Saturday, September 15, 12

    View full-size slide

  22. &0/%&&6(6"3%0
    04.&64"44&54
    public/*
    Saturday, September 15, 12

    View full-size slide

  23. &0/%&&6(6"3%0
    04.&64"44&54
    public/*
    limbo
    Saturday, September 15, 12

    View full-size slide

  24. "44&54
    DTT KBWBTDSJQU
    JNBHFOT GPOUFT
    BVEJP WJEFP
    Saturday, September 15, 12

    View full-size slide

  25. 40.04/&(-*(&/5&4
    $0.$¶%*(0'30/5&/%
    .&"$6-1"
    Saturday, September 15, 12

    View full-size slide

  26. .0%6-"3*;"ª§0
    05*.*;"ª§0
    &
    Saturday, September 15, 12

    View full-size slide

  27. $"."-)"ª0%&"326*704
    26&"6.&/5"0/¼.&30%&
    3&26&454&"-"5­/$*"

    ."/5&356%0&."1&/"4
    6.*.&/40"326*70
    ."/65&/ª§0$3*.*/04"

    9
    1)
    2)
    Saturday, September 15, 12

    View full-size slide

  28. Saturday, September 15, 12

    View full-size slide

  29. Saturday, September 15, 12

    View full-size slide

  30. Saturday, September 15, 12

    View full-size slide

  31. Saturday, September 15, 12

    View full-size slide

  32. Saturday, September 15, 12

    View full-size slide

  33. %*.*/6*3/¼.&30%&3&26*4*ª¸&4)551
    Saturday, September 15, 12

    View full-size slide

  34. %*.*/6*3/¼.&30%&3&26*4*ª¸&4)551
    .*/*'*$"3+"7"4$3*15&$44
    Saturday, September 15, 12

    View full-size slide

  35. %*.*/6*3/¼.&30%&3&26*4*ª¸&4)551
    .*/*'*$"3+"7"4$3*15&$44
    $0.10/&/5&4(;*1
    Saturday, September 15, 12

    View full-size slide

  36. IUUQXXXZPVUVCFDPNXBUDI W6M.Q*)),T
    Saturday, September 15, 12

    View full-size slide

  37. "If a problem is very commom, we end up with a
    proliferation of choices."
    :FIVEB,BU[
    Saturday, September 15, 12

    View full-size slide

  38. “...but we should have to make fewer decisions.”
    :FIVEB,BU[
    Saturday, September 15, 12

    View full-size slide

  39. 4&37*3"44&54/§0¬
    53*7*"-
    Saturday, September 15, 12

    View full-size slide

  40. 6.
    1*1&-*/&
    1"3"03&4("5&
    Saturday, September 15, 12

    View full-size slide

  41. a linear sequence of specialized modules
    which performs a task, like an assembly line
    in a factory.
    pipe.line
    noun
    Saturday, September 15, 12

    View full-size slide

  42. 1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  43. $0.1*-"3
    1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  44. $0.1*-"3 $0/$"5&/"3
    1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  45. $0.1*-"3 $0/$"5&/"3 .*/*'*$"3
    1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  46. $0.1*-"3 $0/$"5&/"3 .*/*'*$"3 $0.13*.*3
    1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  47. $0.1*-"3 $0/$"5&/"3 .*/*'*$"3 $0.13*.*3 $"$)&#645*/(
    1*1&-*/&
    the
    Saturday, September 15, 12

    View full-size slide

  48. QVCMJD\KBWBTDSJQUTcTUZMFTIFFUTcJNBHFT^
    3"*-4
    Saturday, September 15, 12

    View full-size slide

  49. 3"*-4
    Saturday, September 15, 12

    View full-size slide

  50. IUUQXXXZPVUVCFDPNXBUDI WD(E$*)IG"6
    Saturday, September 15, 12

    View full-size slide

  51. "We're elevating this stuff up to the same importance
    as Ruby code itself."
    %BWJE))BOTTPO3BDF$BS%SJWFS
    Saturday, September 15, 12

    View full-size slide

  52. $63"5&%'3".&803,
    Saturday, September 15, 12

    View full-size slide

  53. rails new rs-on-rails
    Saturday, September 15, 12

    View full-size slide

  54. %"%*4$¶3%*"
    (&.'*-&
    Saturday, September 15, 12

    View full-size slide

  55. (FNpMF
    group :assets do
    gem 'sass-rails', '~> 3.2.3'
    # gem 'therubyracer', :platforms => :ruby
    gem 'coffee-rails', '~> 3.2.1'
    gem 'uglifier', '>= 1.0.3'
    end
    Saturday, September 15, 12

    View full-size slide

  56. 0"44&51*1&-*/&*.1¸&
    6."/07"&45365363"
    13"03("/*;"ª§0%&
    "44&54
    Saturday, September 15, 12

    View full-size slide

  57. 0"44&51*1&-*/&*.1¸&
    6."/07"&45365363"
    13"03("/*;"ª§0%&
    "44&54
    Saturday, September 15, 12

    View full-size slide

  58. 0"44&51*1&-*/&46(&3&
    6."/07"&45365363"
    13"03("/*;"ª§0%&
    "44&54
    Saturday, September 15, 12

    View full-size slide

  59. BQQBTTFUT
    MJCBTTFUT
    WFOEPSBTTFUT
    Saturday, September 15, 12

    View full-size slide

  60. Saturday, September 15, 12

    View full-size slide

  61. Saturday, September 15, 12

    View full-size slide

  62. Saturday, September 15, 12

    View full-size slide

  63. Saturday, September 15, 12

    View full-size slide

  64. "44&5#6/%-&4
    Saturday, September 15, 12

    View full-size slide

  65. "44&5#6/%-&4
    BQQMJDBUJPOKT
    BQQMJDBUJPODTT
    Saturday, September 15, 12

    View full-size slide


  66. Rs on Rails
    <%= stylesheet_link_tag "application", media: "all" %>
    <%= javascript_include_tag "application" %>
    <%= csrf_meta_tags %>

    BQQWJFXTMBZPVUTBQQMJDBUJPOIUNMFSC
    Saturday, September 15, 12

    View full-size slide

  67. Saturday, September 15, 12

    View full-size slide

  68. BQQMJDBUJPODTT
    Saturday, September 15, 12

    View full-size slide

  69. BQQMJDBUJPODTT
    SFTFUDTT MBZPVUDTT OBWJHBUJPODTT TJEFCBSDTT UZQPHSBQIZDTT GPSNTDTT UIFNFDTT
    Saturday, September 15, 12

    View full-size slide

  70. /*
    *= require_self
    *= require reset
    *= require layout
    *= require sidebar
    *= require navigation
    *= require typography
    *= require forms
    *= require colors
    */
    BQQWJFXTMBZPVUTBQQMJDBUJPODTT
    Saturday, September 15, 12

    View full-size slide

  71. /*
    *= require_self
    *= require reset
    *= require layout
    *= require sidebar
    *= require navigation
    *= require typography
    *= require forms
    *= require colors
    */
    BQQWJFXTMBZPVUTBQQMJDBUJPODTT
    no jargão, o “manifesto”
    Saturday, September 15, 12

    View full-size slide

  72. Saturday, September 15, 12

    View full-size slide

  73. DPOpHFOWJSPONFOUTEFWFMPQNFOUSC
    RsOnRails::Application.configure do
    config.assets.debug = false
    end
    Saturday, September 15, 12

    View full-size slide

  74. Saturday, September 15, 12

    View full-size slide

  75. DPOpHFOWJSPONFOUTEFWFMPQNFOUSC
    RsOnRails::Application.configure do
    config.assets.compress = true
    end
    Saturday, September 15, 12

    View full-size slide

  76. Saturday, September 15, 12

    View full-size slide

  77. DPOpHFOWJSPONFOUTEFWFMPQNFOUSC
    RsOnRails::Application.configure do
    config.assets.digest = true
    end
    Saturday, September 15, 12

    View full-size slide

  78. Saturday, September 15, 12

    View full-size slide

  79. http://localhost:3000/assets/application.css
    http://localhost:3000/assets/application.js
    Saturday, September 15, 12

    View full-size slide

  80. http://localhost:3000/assets/application.css
    http://localhost:3000/assets/application.js
    Saturday, September 15, 12

    View full-size slide

  81. http://localhost:3000/assets/application.css
    04130$,&54.0/5"6."
    6."3"$,"11/"305"
    BTTFUT
    http://localhost:3000/assets/application.js
    Saturday, September 15, 12

    View full-size slide

  82. IUUQTHJUIVCDPNSBJMTSBJMTCMPCTUBCMFBDUJPOQBDLMJC
    TQSPDLFUTCPPUTUSBQSC-
    Saturday, September 15, 12

    View full-size slide

  83. ."44¶&.
    %&7&-01.&/5
    Saturday, September 15, 12

    View full-size slide

  84. $0.0'*$"&.
    45"(*/(130%6$5*0/
    Saturday, September 15, 12

    View full-size slide

  85. 130%6$5*0/
    4FSWJEPSXFC
    TFSWFPTBSRVJWPT
    QSÉDPNQJMBEPT
    Saturday, September 15, 12

    View full-size slide

  86. DPOpHFOWJSPONFOUTEFWFMPQNFOUSC
    RsOnRails::Application.configure do
    config.assets.compress = false
    config.assets.debug = true
    end
    Saturday, September 15, 12

    View full-size slide

  87. DPOpHFOWJSPONFOUTEFWFMPQNFOUSC
    RsOnRails::Application.configure do
    config.assets.compress = false
    config.assets.debug = true
    end
    RsOnRails::Application.configure do
    config.assets.compress = true
    config.assets.compile = false
    config.assets.digest = true
    end
    DPOpHFOWJSPONFOUTQSPEVDUJPOSC
    Saturday, September 15, 12

    View full-size slide

  88. 04"44&54"/5&4%&&/53"3&.130%6ª§0
    064&+" 13&$*4".04
    13¬$0.1*-"3
    Saturday, September 15, 12

    View full-size slide

  89. $ rake assets:precompile
    Saturday, September 15, 12

    View full-size slide

  90. $ rake assets:precompile
    Saturday, September 15, 12

    View full-size slide

  91. $ rake assets:precompile
    Saturday, September 15, 12

    View full-size slide

  92. /assets/application-9d75ac5c90e71cbe60d8e612a438af43.css
    /assets/application-9d75ac5c90e71cbe60d8e612a438af43.css.gz
    Saturday, September 15, 12

    View full-size slide

  93. /assets/application-9d75ac5c90e71cbe60d8e612a438af43.css
    ✓$0.1*-"%0
    ✓$0/$"5&/"%0
    ✓.*/*'*$"%0
    ✓$"$)&#645&% '*/(&313*/5

    ✓$0.13*.*%0
    /assets/application-9d75ac5c90e71cbe60d8e612a438af43.css.gz
    Saturday, September 15, 12

    View full-size slide

  94. Saturday, September 15, 12

    View full-size slide

  95. ."/*'&45:.-
    Saturday, September 15, 12

    View full-size slide

  96. ---
    Aller_Rg.ttf: Aller_Rg-89086a78088e0ccdf7d5f3a2413b890c.ttf
    rails.png: rails-be8732dac73d845ac5b142c8fb5f9fb0.png
    application.js: application-d47f12ee8bceef5910c0e6d180ecf97c.js
    application.css: application-cf5421f21a42b9b487d6131006c60539.css
    QVCMJDBTTFUTNBOJGFTUZNM
    Saturday, September 15, 12

    View full-size slide

  97. /§064"3¥4-*7&
    $0.1*-"5*0/&.
    130%6ª§0
    Saturday, September 15, 12

    View full-size slide

  98. 70-5"/%0"0"11-*$"5*0/
    #6/%-&
    Saturday, September 15, 12

    View full-size slide

  99. Saturday, September 15, 12

    View full-size slide

  100. $"%­0+26&3:26&
    %&7&3*"&45"3"26*
    Saturday, September 15, 12

    View full-size slide

  101. 4&(63"&44"%¼7*%"
    Saturday, September 15, 12

    View full-size slide

  102. 13¬130$&44"%03&4
    Saturday, September 15, 12

    View full-size slide

  103. TQFBLFSTKT
    Saturday, September 15, 12

    View full-size slide

  104. Saturday, September 15, 12

    View full-size slide

  105. TQFBLFSTDPGGF
    Saturday, September 15, 12

    View full-size slide

  106. GPSNTDTT
    Saturday, September 15, 12

    View full-size slide

  107. Saturday, September 15, 12

    View full-size slide

  108. GPSNTDTTTDTT
    Saturday, September 15, 12

    View full-size slide

  109. GPSNTDTTTDTTFSC
    Saturday, September 15, 12

    View full-size slide

  110. GPSNTDTTTDTTFSC
    $"%&*"%&13¬130$&44".&/50
    Saturday, September 15, 12

    View full-size slide

  111. IUUQTHJUIVCDPNNFUBTLJMMTMFTTSBJMT
    Saturday, September 15, 12

    View full-size slide

  112. IUUQTHJUIVCDPNMVDBTNB[[BSVCZTUZMVT
    Saturday, September 15, 12

    View full-size slide

  113. 4130$,&54
    Saturday, September 15, 12

    View full-size slide

  114. require "sprockets"
    Saturday, September 15, 12

    View full-size slide

  115. require "sprockets"
    env = Sprockets::Environment.new
    Saturday, September 15, 12

    View full-size slide

  116. require "sprockets"
    env = Sprockets::Environment.new
    env.append_path "assets/javascripts"
    Saturday, September 15, 12

    View full-size slide

  117. require "sprockets"
    env = Sprockets::Environment.new
    env.append_path "assets/javascripts"
    application_js = env["application.js"]
    Saturday, September 15, 12

    View full-size slide

  118. require "sprockets"
    env = Sprockets::Environment.new
    env.append_path "assets/javascripts"
    application_js = env["application.js"]
    logical path
    Saturday, September 15, 12

    View full-size slide

  119. puts application_js.inspect
    Saturday, September 15, 12

    View full-size slide

  120. puts application_js.inspect
    # ## pathname="/Users/rondy/sprockets/assets/javascripts/application.js",
    # mtime=2012-09-02 17:08:34 -0300,
    # digest="e643622cbd2c3f4d29b5fad9e329b2e8">
    Saturday, September 15, 12

    View full-size slide

  121. puts application_js
    Saturday, September 15, 12

    View full-size slide

  122. puts application_js
    # contents of `application.js` with its concatenated dependencies
    Saturday, September 15, 12

    View full-size slide

  123. "1&/"4."*46."
    .06/5"#-&3"$,"11
    Saturday, September 15, 12

    View full-size slide

  124. require 'sprockets'
    map '/assets' do
    environment = Sprockets::Environment.new
    environment.append_path 'app/assets/javascripts'
    environment.append_path 'app/assets/stylesheets'
    run environment
    end
    map '/' do
    run YourRackApp
    end
    Saturday, September 15, 12

    View full-size slide

  125. 4130$,&54

    Saturday, September 15, 12

    View full-size slide

  126. guard 'sprockets', destination: "build/javascripts",
    asset_paths: ['/src/javascripts'] do
    watch (%r{src/javascripts/application.js})
    end
    (VBSEpMF
    Saturday, September 15, 12

    View full-size slide

  127. 70-5"/%0"0
    (&.'*-&%"
    %*4$¶3%*"
    Saturday, September 15, 12

    View full-size slide

  128. (FNpMF
    group :assets do
    gem 'sass-rails', '~> 3.2.3'
    # gem 'therubyracer', :platforms => :ruby
    gem 'coffee-rails', '~> 3.2.1'
    gem 'uglifier', '>= 1.0.3'
    end
    Saturday, September 15, 12

    View full-size slide

  129. gem 'therubyracer', :platforms => :ruby
    Saturday, September 15, 12

    View full-size slide

  130. &9&$+4
    Saturday, September 15, 12

    View full-size slide

  131. &9&$+4
    +"7"4$3*1536#:
    Saturday, September 15, 12

    View full-size slide

  132. require "execjs"
    Saturday, September 15, 12

    View full-size slide

  133. require "execjs"
    ExecJS.eval "'red yellow blue'.split(' ')"
    Saturday, September 15, 12

    View full-size slide

  134. require "execjs"
    ExecJS.eval "'red yellow blue'.split(' ')"
    # => ["red", "yellow", "blue"]
    Saturday, September 15, 12

    View full-size slide

  135. $PGGF4DSJQU
    6HMJGZGSJFOET
    Saturday, September 15, 12

    View full-size slide

  136. $PGGF4DSJQU
    6HMJGZGSJFOET
    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  137. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  138. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    /PEFKT
    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  139. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    /PEFKT
    "QQMF
    +BWB4DSJQU$PSF
    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  140. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    /PEFKT
    "QQMF
    +BWB4DSJQU$PSF
    .JDSPTPGU8JOEPXT
    4DSJQU)PTU
    +4DSJQU

    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  141. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    /PEFKT
    UIFSVCZSBDFS
    "QQMF
    +BWB4DSJQU$PSF
    .JDSPTPGU8JOEPXT
    4DSJQU)PTU
    +4DSJQU

    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  142. 36/5*.&
    $PGGF4DSJQU
    6HMJGZGSJFOET
    /PEFKT
    UIFSVCZSBDFS
    UIFSVCZSIJOP
    "QQMF
    +BWB4DSJQU$PSF
    .JDSPTPGU8JOEPXT
    4DSJQU)PTU
    +4DSJQU

    &YFD+4
    Saturday, September 15, 12

    View full-size slide

  143. Saturday, September 15, 12

    View full-size slide

  144. gem 'therubyracer', :platforms => :ruby
    Saturday, September 15, 12

    View full-size slide

  145. gem 'therubyrhino', :platforms => :jruby
    Saturday, September 15, 12

    View full-size slide

  146. Saturday, September 15, 12

    View full-size slide

  147. %*$"4 53626&4&
    0653"4
    '&*5*ª"3*"4
    Saturday, September 15, 12

    View full-size slide

  148. 4130$,&5494"44
    Saturday, September 15, 12

    View full-size slide

  149. $base-font-color: #555555;
    BQQBTTFUTTUZMFTIFFUTDPNNPODTTTDTT
    Saturday, September 15, 12

    View full-size slide

  150. /*
    *= require common
    */
    body {
    color: $base-font-color;
    }
    BQQBTTFUTTUZMFTIFFUTBQQMJDBUJPODTTTDTT
    $base-font-color: #555555;
    BQQBTTFUTTUZMFTIFFUTDPNNPODTTTDTT
    Saturday, September 15, 12

    View full-size slide

  151. Saturday, September 15, 12

    View full-size slide

  152. SFRVJSFTBTT
    Saturday, September 15, 12

    View full-size slide

  153. /*
    */
    @import "common.css.scss";
    body {
    color: $base-font-color;
    }
    BQQBTTFUTTUZMFTIFFUTBQQMJDBUJPODTTTDTT
    Saturday, September 15, 12

    View full-size slide

  154. $3*"/%0/04404
    13¶13*0413¬
    130$&44"%03&4
    Saturday, September 15, 12

    View full-size slide

  155. class TimestampProcessor < Sprockets::Processor
    end
    MJCQSPDFTTPSTUJNFTUBNQ@QSPDFTTPSSC
    Saturday, September 15, 12

    View full-size slide

  156. class TimestampProcessor < Sprockets::Processor
    def evaluate(context, locals)
    end
    end
    MJCQSPDFTTPSTUJNFTUBNQ@QSPDFTTPSSC
    Saturday, September 15, 12

    View full-size slide

  157. class TimestampProcessor < Sprockets::Processor
    def evaluate(context, locals)
    data
    end
    end
    MJCQSPDFTTPSTUJNFTUBNQ@QSPDFTTPSSC
    Saturday, September 15, 12

    View full-size slide

  158. class TimestampProcessor < Sprockets::Processor
    def evaluate(context, locals)
    current_timestamp = DateTime.now.to_s(:timestamp)
    ["/* #{current_timestamp} */", data].join("\n")
    end
    end
    MJCQSPDFTTPSTUJNFTUBNQ@QSPDFTTPSSC
    Saturday, September 15, 12

    View full-size slide

  159. require "processors/timestamp_processor"
    Rails.application.assets.
    register_postprocessor("text/css", TimestampProcessor)
    DPOpHJOJUJBMJ[FSTTQSPDLFUTSC
    Saturday, September 15, 12

    View full-size slide

  160. require "processors/timestamp_processor"
    Rails.application.assets.
    register_postprocessor("text/css", TimestampProcessor)
    Rails.application.assets.
    register_postprocessor("application/javascript", TimestampProcessor)
    DPOpHJOJUJBMJ[FSTTQSPDLFUTSC
    Saturday, September 15, 12

    View full-size slide

  161. Saturday, September 15, 12

    View full-size slide

  162. (&.*'*$"/%0"44&54
    3&64¥7&*4
    Saturday, September 15, 12

    View full-size slide

  163. (&.*'*$"/%0"44&54
    3&64¥7&*4
    ","$0.04&34)08

    Saturday, September 15, 12

    View full-size slide

  164. 4)08 /§04)08%&45
    Saturday, September 15, 12

    View full-size slide

  165. var Showdest = {
    description: "Are you showdest, my friend?"
    }
    alert(Showdest.description);
    //= require_self
    //= require showdest
    BQQBTTFUTKBWBTDSJQUTTIPXEFTUKT
    BQQBTTFUTKBWBTDSJQUTBQQMJDBUJPOKT
    Saturday, September 15, 12

    View full-size slide

  166. Saturday, September 15, 12

    View full-size slide

  167. $ bundle gem showdest
    Saturday, September 15, 12

    View full-size slide

  168. $ bundle gem showdest
    $ cd showdest
    Saturday, September 15, 12

    View full-size slide

  169. $ bundle gem showdest
    $ cd showdest
    $ mkdir -p vendor/assets/javascript
    Saturday, September 15, 12

    View full-size slide

  170. $ bundle gem showdest
    $ cd showdest
    $ mkdir -p vendor/assets/javascript
    $ mv ~/code/rs-on-rails/app/assets/javascripts/showdest.js \
    vendor/assets/javascript
    Saturday, September 15, 12

    View full-size slide

  171. Saturday, September 15, 12

    View full-size slide

  172. group :assets do
    gem 'showdest', path: '/Users/rondy/code/showdest'
    end
    (FNpMF
    Saturday, September 15, 12

    View full-size slide

  173. $ bundle && rails s
    Saturday, September 15, 12

    View full-size slide

  174. $ bundle && rails s
    Saturday, September 15, 12

    View full-size slide

  175. module Showdest
    class Engine < Rails::Engine
    end
    end
    TIPXEFTUMJCTIPXEFTUFOHJOFSC
    Saturday, September 15, 12

    View full-size slide

  176. module Showdest
    class Engine < Rails::Engine
    end
    end
    TIPXEFTUMJCTIPXEFTUFOHJOFSC
    Gem::Specification.new do |gem|
    gem.add_dependency "railties", ">= 3.1", "< 5.0"
    end
    TIPXEFTUTIPXEFTUHFNTQFD
    Saturday, September 15, 12

    View full-size slide

  177. require "showdest/version"
    require "showdest/engine"
    module Showdest
    end
    TIPXEFTUMJCTIPXEFTUSC
    Saturday, September 15, 12

    View full-size slide

  178. $ bundle && rails s
    Saturday, September 15, 12

    View full-size slide

  179. $ bundle && rails s
    Saturday, September 15, 12

    View full-size slide

  180. -&.#3"%0+26&3:
    Saturday, September 15, 12

    View full-size slide

  181. (&.3"*-4&/(*/&
    Saturday, September 15, 12

    View full-size slide

  182. Saturday, September 15, 12

    View full-size slide

  183. Saturday, September 15, 12

    View full-size slide

  184. Saturday, September 15, 12

    View full-size slide

  185. "-5&3/"5*7"4
    Saturday, September 15, 12

    View full-size slide

  186. rails new rs-on-rails \
    --skip-sprockets
    Saturday, September 15, 12

    View full-size slide

  187. IUUQEPDVNFOUDMPVEHJUIVCDPNKBNNJU
    Saturday, September 15, 12

    View full-size slide

  188. IUUQTHJUIVCDPNMJWJOHTPDJBMSBLFQJQFMJOF
    Saturday, September 15, 12

    View full-size slide

  189. "*/%")¥.6*50."*4
    Saturday, September 15, 12

    View full-size slide

  190. IUUQHVJEFTSVCZPOSBJMTPSHBTTFU@QJQFMJOFIUNM
    Saturday, September 15, 12

    View full-size slide

  191. IUUQDPEFSCFSSZNFCMPHBTTFUQJQFMJOFGPSEVNNJFT
    Saturday, September 15, 12

    View full-size slide

  192. IUUQBLJUBPOSBJMTDPNBTTFUQJQFMJOFQBSBJOJDJBOUFT
    IUUQBLJUBPOSBJMTDPNBTTFUQJQFMJOFQBSBJOJDJBOUFTQBSUF
    Saturday, September 15, 12

    View full-size slide

  193. IUUQSBJMTDBTUTDPNFQJTPEFTVOEFSTUBOEJOHUIFBTTFUQJQFMJOF
    IUUQSBJMTDBTUTDPNFQJTPEFTBTTFUQJQFMJOFJOQSPEVDUJPO
    Saturday, September 15, 12

    View full-size slide

  194. IUUQCMPHNJOVUFTDPNVOUBOHMJOHUIFSBJMTBTTFUQJQFMJOFQBSUDBDIFTBOEDPNQBTT
    IUUQCMPHNJOVUFTDPNVOUBOHMJOHUIFSBJMTBTTFUQJQFMJOFQBSUQSPEVDUJPO
    IUUQCMPHNJOVUFTDPNVOUBOHMJOHUIFSBJMTBTTFUQJQFMJOFQBSUDPOpHVSBUJPO
    IUUQCMPHNJOVUFTDPNVOUBOHMJOHUIFSBJMTBTTFUQJQFMJOFQBSUUSPVCMFTIPPUJOH
    Saturday, September 15, 12

    View full-size slide

  195. IUUQQSBHQSPHDPNCPPLXBSWUIFSBJMTWJFX
    Saturday, September 15, 12

    View full-size slide

  196. Saturday, September 15, 12

    View full-size slide

  197. &45".04$0/53"5"/%0 5$)­
    IUUQQMBUBGPSNBUFDDPNCSDPOUBDU
    Saturday, September 15, 12

    View full-size slide

  198. 0#3*("%0
    Saturday, September 15, 12

    View full-size slide