Let's say I create a new leiningen project and edit the project.clj file so it looks something like the following.
(defproject foobar "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.5.1"]
...
[clj-webmaster-tools "0.1.0"]]
:plugins [[lein-ring "0.8.6"]
[lein-webmaster-tools "0.1.0"]
:webmaster {:sitemap "http://www.foobar.com/sitemap-index.xml" :robots "http://www.foobar.com/robots.txt"})
My question is, how do I access the :webmaster key in the project map for use in a leningen plugin I'm writing?
When you write a plugin, the first parameter passed to your plugin function is the project map. It's a standard Clojure persistent map, so you can access it like any other map, i.e.
(defn my-plugin[project]
(println (:webmaster project)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With