Skip to content

Instantly share code, notes, and snippets.

@levand
Last active February 22, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levand/d387bfc5cbcc36ecb529782aa880c3ab to your computer and use it in GitHub Desktop.
Save levand/d387bfc5cbcc36ecb529782aa880c3ab to your computer and use it in GitHub Desktop.
;; Sample of what the new DSL could look like
(config
(:require
[arachne.core.dsl :as a]
[arachne.http.dsl :as http]
[arachne.pedestal.dsl :as pedestal]
[arachne.assets.dsl :as asset]
[arachne.pedestal-assets.dsl :as pedestal-asset]
[arachne.cljs.dsl :as cljs]
[arachne.figwheel.dsl :as fig]))
;; Make things shorter to type...
(alias 'app 'org.arachne-framework.template.enterprise-spa)
;; Always in dev mode, for now
(def dev? (constantly true))
;; Runtime setup
(a/def ::app/runtime (a/runtime [::app/figwheel ::app/server]))
;; HTTP Server setup
(a/def ::app/server
(pedestal/server 8080
(a/def ::app/asset-interceptor (pedestal-asset/interceptor :index? true))
(http/endpoint :get "/healthcheck"
(http/handler 'org.arachne-framework.template.enterprise-spa.web/healthcheck))
))
;; Asset Pipeline setup
(a/def ::app/public-dir (asset/input-dir "public" :classpath? true :watch? (dev?)))
(asset/pipeline [::app/public-dir ::app/asset-interceptor])
(def cljs-opts {:main 'org.arachne-framework.template.enterprise-spa
:optimizations (if (dev?) :none :advanced)
:asset-path "js/out"
:output-to "js/app.js"
:output-dir "js/out"
:source-map-timestamp true})
(a/def ::app/src-dir (asset/input-dir "src" :watch? (dev?)))
;; For prod mode, use a standard CLJS build pipeline
(a/def ::app/cljs (cljs/build cljs-opts))
(asset/pipeline [::app/src-dir ::app/cljs])
;; Figwheel ClojureScript setup (dynamic CLJS development)
(a/def ::app/figwheel (fig/server cljs-opts :port 8888))
(asset/pipeline
[::app/src-dir ::app/figwheel #{:src}]
[::app/public-dir ::app/figwheel #{:public}])
;; Always use Figwheel for builds in dev
(if (dev?)
(asset/pipeline [::app/figwheel ::app/asset-interceptor])
(asset/pipeline [::app/cljs ::app/asset-interceptor]))
@rubygeek
Copy link

I like it :) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment