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

How To Train Your Moovweb

Avatar for benbayard benbayard
June 17, 2014
100

How To Train Your Moovweb

Avatar for benbayard

benbayard

June 17, 2014

Transcript

  1. How does Moovweb Work? Moovweb transforms assets from an existing

    source into something else. In our case, a mobile site.
  2. what is xpath? xpath is a document query language based

    around Treating the document as a tree.
  3. Tritium takes as input HTML documents and outputs HTML that

    has been transformed according the rules defined in the Tritium script.
  4. Like jQuery, idiomatic Tritium code is structured around selecting a

    collection of elements via a CSS or XPath selector and then chaining a series of operations on them.
  5. input tritium OutpuT html_fragment() { $("/div/p") { text() { replace(/Hello/,

    "Goodbye") } } } <div> <p> Hello World! </p> </div> <div> <p> Goodbye World! </p> </div>
  6. In tritium most standard functions allow you to open a

    scope. The context of this scope is related to whichever element the function decides to return
  7. tritium html() { # <-- scope $(".//section") { # <--

    scope insert("div", class:"open-scope here") } }
  8. If you notice yourself copy- pasting code or doing the

    same actions all the time, try reusing that functionality in a function!