forked from bhauman/lein-figwheel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start adding examples of different figwheel behavior
- Loading branch information
Bruce Hauman
committed
Jan 29, 2017
1 parent
01c5af7
commit 8069e64
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# node-example | ||
|
||
A simple figwheel node example. | ||
|
||
Make sure you have ws installed | ||
|
||
npm install ws | ||
|
||
Start figwheel | ||
|
||
lein figwheel | ||
|
||
Start node | ||
|
||
node target/js/compiled/node_example.js | ||
|
||
Make sure your REPL isn't connecting to a browser. | ||
|
||
Now you can interact in the REPL and edit and save `src/node_example/core.cljs` | ||
|
||
## Things of note in the project.clj | ||
|
||
In the `project.clj` you will see the build has `:target :nodejs`. It | ||
is also important to set `:asset-path` so that you can launch node | ||
from the root of the project. | ||
|
||
## License | ||
|
||
Copyright © 2014 FIXME | ||
|
||
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(defproject node-example "0.1.0-SNAPSHOT" | ||
:description "FIXME: write this!" | ||
:url "http://example.com/FIXME" | ||
:license {:name "Eclipse Public License" | ||
:url "http://www.eclipse.org/legal/epl-v10.html"} | ||
|
||
:min-lein-version "2.7.1" | ||
|
||
:dependencies [[org.clojure/clojure "1.9.0-alpha14"] | ||
[org.clojure/clojurescript "1.9.229"]] | ||
|
||
:plugins [[lein-figwheel "0.5.9-SNAPSHOT"]] | ||
|
||
:source-paths ["src"] | ||
|
||
:cljsbuild {:builds | ||
[{:id "node-dev" | ||
:source-paths ["src"] | ||
:figwheel true | ||
:compiler {:main node-example.core | ||
;; in order to call node from root of project | ||
;; need to asset same as :output-dir | ||
:asset-path "target/js/compiled/out" | ||
:output-to "target/js/compiled/node_example.js" | ||
:output-dir "target/js/compiled/out" | ||
:source-map-timestamp true | ||
;; !!! need to set the target to :nodejs !!! | ||
:target :nodejs}}]} | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(ns node-example.core | ||
(:require [cljs.nodejs :as nodejs] | ||
[goog.object :as gobj] | ||
[goog.string :as gstring] | ||
[clojure.string :as string])) | ||
|
||
(nodejs/enable-util-print!) | ||
|
||
(println "Hello from the Node!") | ||
|
||
(defn helper [] "hey there") | ||
|
||
(def -main (fn [] nil)) | ||
|
||
(set! *main-cli-fn* -main) | ||
|
||
|