Slide 1

Slide 1 text

Hi

Slide 2

Slide 2 text

WHAT'S BOOT?

Slide 3

Slide 3 text

WHY ANOTHER BUILD TOOL?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

(page "index.html" (:refer-clojure :exclude [nth]) ;; A lot more ClojureScript

Slide 6

Slide 6 text

NO ABSTRACTIONS FOR BUILD PROCESSES

Slide 7

Slide 7 text

TIME PASSES...

Slide 8

Slide 8 text

2.0

Slide 9

Slide 9 text

HOW

Slide 10

Slide 10 text

TASKS ABSTRACTIONS FOR BUILD PROCESSES

Slide 11

Slide 11 text

;; build.boot (set-env! :source-paths #{"src"} :dependencies '[[pandeiro/boot-http "0.4.2"] ...]) (require '[pandeiro.boot-http :refer [serve]] ...) (deftask run [] (comp (serve) ; serve files (speak) ; audible notifications (watch) ; trigger new builds (cljs-repl) ; cljs REPL - hah! (reload) ; Figwheel style reloading (build)))

Slide 12

Slide 12 text

;; build.boot (set-env! :source-paths #{"src"} :dependencies '[[pandeiro/boot-http "0.4.2"] ...]) (require '[pandeiro.boot-http :refer [serve]] ...) (deftask build [] (comp (cljx) (cljs) (garden))) (deftask run [] (comp (serve) ; serve files (speak) ; audible notifications (watch) ; trigger new builds (cljs-repl) ; cljs REPL - hah! (reload) ; Figwheel style reloading (build)))

Slide 13

Slide 13 text

COMPOSE ALL THE THINGS

Slide 14

Slide 14 text

BUT... SIDE EFFECTS EVERYWHERE?

Slide 15

Slide 15 text

FILESET FILES AS VALUES

Slide 16

Slide 16 text

DEPENDENCY ISOLATION

Slide 17

Slide 17 text

PODS ISOLATED CLOJURE RUNTIMES

Slide 18

Slide 18 text

TWO MORE QUICK THINGS

Slide 19

Slide 19 text

TASK OPTIONS (boot (cljs :optimizations :advanced)) ; REPL

Slide 20

Slide 20 text

TASK OPTIONS (boot (cljs :optimizations :advanced)) ; REPL CLI <> REPL SYMMETRY boot serve watch cljs -O advanced # SHELL (boot (serve) (watch) (cljs :optimizations :advanced)) ; REPL

Slide 21

Slide 21 text

Demo

Slide 22

Slide 22 text

(ns boot-garden.core {:boot/export-tasks true} (:require [clojure.java.io :as io] [boot.core :as boot :refer [deftask]] [boot.pod :as pod] [boot.file :as file] [boot.util :as util])) (def initial (atom true)) (defn add-dep [env dep] (update-in env [:dependencies] (fnil conj []) dep)) (defn ns-tracker-pod [] (pod/make-pod (assoc-in (boot/get-env) [:dependencies] '[[ns-tracker "0.2.2"]]))) (defn garden-pool [] (pod/pod-pool (add-dep (boot/get-env) '[garden "1.2.5"]) :init (fn [pod] (pod/require-in pod 'garden.core)))) (deftask garden "compile garden" [o output-to PATH str "The output css file path relative to docroot." s styles-var SYM sym "The var containing garden rules" p pretty-print bool "Pretty print compiled CSS" v vendors [str] "Vendors to apply prefixed for" a auto-prefix [str] "Properties to auto-prefix with vendor-prefixes"] (let [output-path (or output-to "main.css") css-var styles-var ns-sym (symbol (namespace css-var)) tmp (boot/temp-dir!) out (io/file tmp output-path) src-paths (vec (boot/get-env :source-paths)) garden-pods (garden-pool) ns-pod (ns-tracker-pod)] (pod/with-eval-in ns-pod (require 'ns-tracker.core) (def cns (ns-tracker.core/ns-tracker ~src-paths))) (boot/with-pre-wrap fileset (when (or @initial (some #{ns-sym} (pod/with-eval-in ns-pod (cns)))) (let [c-pod (garden-pods :refresh)] (if @initial (reset! initial false)) (util/info "Compiling %s...\n" (.getName out)) (io/make-parents out) (pod/with-eval-in c-pod (require '~ns-sym) (garden.core/css {:output-to ~(.getPath out) :pretty-print ~pretty-print :vendors ~vendors :auto-prefix ~(set auto-prefix)} ~css-var)))) (-> fileset (boot/add-resource tmp) boot/commit!))))

Slide 23

Slide 23 text

(ns boot-garden.core {:boot/export-tasks true} (:require [clojure.java.io :as io] [boot.core :as boot :refer [deftask]] [boot.pod :as pod] [boot.file :as file] [boot.util :as util]))

Slide 24

Slide 24 text

;; (ns boot-garden.core ;; {:boot/export-tasks true} ;; (:require [clojure.java.io :as io] ;; [boot.core :as boot :refer [deftask]] ;; [boot.pod :as pod] ;; [boot.file :as file] ;; [boot.util :as util])) (def initial (atom true))

Slide 25

Slide 25 text

;; ... ;; (def initial ;; (atom true)) (defn add-dep [env dep] (update-in env [:dependencies] (fnil conj []) dep)) (defn ns-tracker-pod [] (pod/make-pod (assoc-in (boot/get-env) [:dependencies] '[[ns-tracker "0.2.2"]]))) (defn garden-pool [] (pod/pod-pool (add-dep (boot/get-env) '[garden "1.2.5"]) :init (fn [pod] (pod/require-in pod 'garden.core))))

Slide 26

Slide 26 text

;; ... ;; (defn garden-pool [] ;; (pod/pod-pool (add-dep (boot/get-env) '[garden "1.2.5"]) ;; :init (fn [pod] (pod/require-in pod 'garden.core)))) (deftask garden "compile garden" [o output-to PATH str "The output css file path relative to docroot." s styles-var SYM sym "The var containing garden rules" p pretty-print bool "Pretty print compiled CSS" v vendors [str] "Vendors to apply prefixed for" a auto-prefix [str] "Properties to auto-prefix with vendor-prefixes"]

Slide 27

Slide 27 text

;; ... ;; (deftask garden ;; "compile garden" ;; [o output-to PATH str "The output css file path relative to docroot." ;; s styles-var SYM sym "The var containing garden rules" ;; p pretty-print bool "Pretty print compiled CSS" ;; v vendors [str] "Vendors to apply prefixed for" ;; a auto-prefix [str] "Properties to auto-prefix with vendor-prefixes"] (let [output-path (or output-to "main.css") ns-sym (symbol (namespace styles-var)) tmp (boot/temp-dir!) out (io/file tmp output-path) src-paths (vec (boot/get-env :source-paths)) garden-pods (garden-pool) ns-pod (ns-tracker-pod)]

Slide 28

Slide 28 text

;; ... ;; (let [output-path (or output-to "main.css") ;; ns-sym (symbol (namespace styles-var)) ;; tmp (boot/temp-dir!) ;; out (io/file tmp output-path) ;; src-paths (vec (boot/get-env :source-paths)) ;; garden-pods (garden-pool) ;; ns-pod (ns-tracker-pod)] (pod/with-eval-in ns-pod (require 'ns-tracker.core) (def cns (ns-tracker.core/ns-tracker ~src-paths)))

Slide 29

Slide 29 text

;; ... ;; (pod/with-eval-in ns-pod ;; (require 'ns-tracker.core) ;; (def cns (ns-tracker.core/ns-tracker ~src-paths))) (boot/with-pre-wrap fileset (when (or @initial (some #{ns-sym} (pod/with-eval-in ns-pod (cns)))) (let [c-pod (garden-pods :refresh)] (if @initial (reset! initial false)) (util/info "Compiling %s...\n" (.getName out)) (io/make-parents out)

Slide 30

Slide 30 text

;; ... ;; (boot/with-pre-wrap fileset ;; (when (or @initial (some #{ns-sym} (pod/with-eval-in ns-pod (cns)))) ;; (let [c-pod (garden-pods :refresh)] ;; (if @initial (reset! initial false)) ;; (util/info "Compiling %s...\n" (.getName out)) ;; (io/make-parents out) (pod/with-eval-in c-pod (require '~ns-sym) (garden.core/css {:output-to ~(.getPath out) :pretty-print ~pretty-print :vendors ~vendors :auto-prefix ~(set auto-prefix)} ~css-var));))

Slide 31

Slide 31 text

;; ... ;; (boot/with-pre-wrap fileset ;; (when (or @initial (some #{ns-sym} (pod/with-eval-in ns-pod (cns)))) ;; (let [c-pod (garden-pods :refresh)] ;; (if @initial (reset! initial false)) ;; (util/info "Compiling %s...\n" (.getName out)) ;; (io/make-parents out) ;; (pod/with-eval-in c-pod ;; (require '~ns-sym) ;; (garden.core/css {:output-to ~(.getPath out) ;; :pretty-print ~pretty-print ;; :vendors ~vendors ;; :auto-prefix ~(set auto-prefix)} ~css-var));)) (-> fileset (boot/add-resource tmp) boot/commit!);)))

Slide 32

Slide 32 text

Done!

Slide 33

Slide 33 text

RESOURCES

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

#HOPLON (IRC)

Slide 36

Slide 36 text

TENZING lein new tenzing your-app

Slide 37

Slide 37 text

FAZIT

Slide 38

Slide 38 text

THANK YOU @martinklepsch

Slide 39

Slide 39 text

QUESTIONS? @martinklepsch