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

Express Templates - Declarative Views With Components

Express Templates - Declarative Views With Components

I present a new approach to view templates in Rails as an alternative to ERB/Haml/etc. This approach uses a declarative style for assembling server-side rendered Web UI from a hierarchy of reusable component objects. I delivered this as a lightning talk at RubyConf 2014.

Steven Talcott Smith

November 21, 2014
Tweet

Other Decks in Programming

Transcript

  1. E X P R E S S T E M

    P L AT E S D E C L A R A T I V E V I E W S W I T H C O M P O N E N T S U S I N G ælogica
  2. C O D E , O U R F R

    I E N E M Y W E L O V E C O D E , W E H A T E C O D E STEVEN TALCOTT SMITH - ælogica
  3. P R O C E D U R A L

    L O G I C P R O L I F E R AT E S B R E V I T Y I S T H E S O U L O F W I T ælogica
  4. D E C L A R AT I V E

    C O D E I S C O N C I S E R E Q U I R E S F E W E R T E S T S , E A S I E R T O M A I N TA I N ælogica
  5. V I E W C O D E I S

    A M E S S L I T T L E R E U S E — T O O M U C H H A N D C R A F T I N G ælogica
  6. A N E X P R E S S T

    E M P L AT E M A K E Y O U R H T M L 5 V I E W T E M P L A T E S I N R U B Y
  7. A C U S T O M C O M

    P O N E N T M A K E V I E W C O M P O N E N T S A S R E G U L A R R U B Y C L A S S E S
  8. H O W I T W O R K S

    compile() out << "<h1> #{@title} </h1>" eval() Haml/Erb/Slim The Rails View Ruby Code Doing String Buffer Stuff <h1>Hi </h1> @title = "Hi" Helpers index.html.haml ExpressTemplates out << "<h1> #{@title} </h1>" eval() The Rails View Ruby Code Doing String Buffer Stuff <h1>Hi </h1> @title = "Hi" Components, Tags, & Wrappers for Helpers Helpers expand() Nodes compile() index.html.et
  9. C O M P O N E N T L

    I B R A R I E S N O W W E C A N M A K E • TableFor • TreeFor • TreeTableFor • Advanced Form Components • Web Components! • Behaviors • And More! All of which can be extended in OO FasHion
  10. C H E C K I T O U T

    E X P R E S S T E M P L A T E S github.com/aelogica/express_templates We are using this in our admin framework. Expect 1.0 release in Q1 2015 ælogica
  11. S T E V E N TA L C O

    T T S M I T H ælogica 
 Great Software Teams for Hire
 Lake Tahoe — Manila T H A N K Y O U Level Up!
 Tips & Techniques to become a better Professional Software Developer leanpub.com/level_up/c/rubyconf2014 @stalcottsmith — [email protected]
  12. R U B Y C O N F. P H

    P H I L I P P I N E S • March 27-28, 2015 • Boracay Island • Crown Regency Resort