Skip to content

Update README.md #7

Closed
wants to merge 1 commit into from
+57 −3
View
60 README.md
@@ -9,13 +9,11 @@ ClojureScript.
## Usage
To install using Leiningen, simply add the plugin to your
-~/.lein/profiles.clj file:
-
+~/.lein/profiles.clj file
```clojure
{:user {:plugins [...
[lein-catnip "0.4.1"]]}}
```
-
You can now launch it from within your own Leiningen projects like
this:
@@ -26,6 +24,62 @@ this:
This will launch the Catnip web server and open it in your browser.
You'll be able to start writing code right away.
+### Working with Noir and lein2.
+
+Add
+```clojure
+ [lein-catnip "0.4.1"]
+```
+to :dependencies section of project.clj file
+```clojure
+ :dependencies [[org.clojure/clojure "1.4.0"]
+ [noir "1.3.0-beta10"]
+ [lein-catnip "0.4.1"]]
+```
+Run "lein deps" this will install all dependencies.
+Add
+```clojure
+ :plugins [[lein-catnip "0.4.1"]]
+```
+to project.clj to use "lein edit" command.
+Finally add
+```clojure
+ :main ^{:skip-aot true} yourproject.server
+```
+This will skip Ahead-of-time compilation.
+
+It will look something like this:
+```clojure
+(defproject testpro "0.1.0-SNAPSHOT"
+ :plugins [[lein-catnip "0.4.1"]]
+ :description "FIXME: write description"
+ :url "http://example.com/FIXME"
+ :license {:name "Eclipse Public License"
+ :url "http://www.eclipse.org/legal/epl-v10.html"}
+ :dependencies [[org.clojure/clojure "1.4.0"]
+ [noir "1.3.0-beta10"]
+ [lein-catnip "0.4.1"]]
+ :main ^{:skip-aot true} testpro.server)
+```
+Then we need to define main function in server.clj file.
+
+Add to "src/yourproject/server.clj"
+```clojure
+ (defn -main [& args]
+ (server/start 8080))
+```
+Run "lein edit". This will launch the Catnip web server and open it in your browser.
+
+Open "src/yourproject/server.clj" with Ctrl+F.
+
+Then we need to run main function (-main) in the repl but in context of the app.
+To switch context do Ctrl+S then Ctrl+R this will switch you to the repl and then (-main) this will start Noir server.
+
+Edit url in right panel to "http://localhost:8080/" this will load your "/" page if you have one.
+
+That's it !
+
+
### Quickstart
Once you've installed the plugin as detailed above, this is all you
Something went wrong with that request. Please try again.