-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
434 additions
and
2,923 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ pom.xml | |
/node_modules | ||
/*-init.clj | ||
/*.iml | ||
/.lein-failures | ||
.lein-failures |
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,13 @@ | ||
/resources/public/js/compiled/** | ||
figwheel_server.log | ||
pom.xml | ||
*jar | ||
/lib/ | ||
/classes/ | ||
/out/ | ||
/target/ | ||
.lein-deps-sum | ||
.lein-repl-history | ||
.lein-plugins/ | ||
.repl | ||
.nrepl-port |
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,39 @@ | ||
# counter | ||
|
||
FIXME: Write a one-line description of your library/project. | ||
|
||
## Overview | ||
|
||
FIXME: Write a paragraph about the library/project and highlight its goals. | ||
|
||
## Setup | ||
|
||
To get an interactive development environment run: | ||
|
||
lein figwheel | ||
|
||
and open your browser at [localhost:3449](http://localhost:3449/). | ||
This will auto compile and send all changes to the browser without the | ||
need to reload. After the compilation process is complete, you will | ||
get a Browser Connected REPL. An easy way to try it is: | ||
|
||
(js/alert "Am I connected?") | ||
|
||
and you should see an alert in the browser window. | ||
|
||
To clean all compiled files: | ||
|
||
lein clean | ||
|
||
To create a production build run: | ||
|
||
lein do clean, cljsbuild once min | ||
|
||
And open your browser in `resources/public/index.html`. You will not | ||
get live reloading, nor a REPL. | ||
|
||
## 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,42 @@ | ||
(ns user | ||
(:require | ||
[figwheel-sidecar.repl-api :as f])) | ||
|
||
;; user is a namespace that the Clojure runtime looks for and | ||
;; loads if its available | ||
|
||
;; You can place helper functions in here. This is great for starting | ||
;; and stopping your webserver and other development services | ||
|
||
;; The definitions in here will be available if you run "lein repl" or launch a | ||
;; Clojure repl some other way | ||
|
||
;; You have to ensure that the libraries you :require are listed in your dependencies | ||
|
||
;; Once you start down this path | ||
;; you will probably want to look at | ||
;; tools.namespace https://github.com/clojure/tools.namespace | ||
;; and Component https://github.com/stuartsierra/component | ||
|
||
|
||
(defn fig-start | ||
"This starts the figwheel server and watch based auto-compiler." | ||
[] | ||
;; this call will only work are long as your :cljsbuild and | ||
;; :figwheel configurations are at the top level of your project.clj | ||
;; and are not spread across different lein profiles | ||
|
||
;; otherwise you can pass a configuration into start-figwheel! manually | ||
(f/start-figwheel!)) | ||
|
||
(defn fig-stop | ||
"Stop the figwheel server and watch based auto-compiler." | ||
[] | ||
(f/stop-figwheel!)) | ||
|
||
;; if you are in an nREPL environment you will need to make sure you | ||
;; have setup piggieback for this to work | ||
(defn cljs-repl | ||
"Launch a ClojureScript REPL that is connected to your build and host environment." | ||
[] | ||
(f/cljs-repl)) |
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,105 @@ | ||
(defproject counter "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.8.0"] | ||
[org.clojure/clojurescript "1.9.456"] | ||
[carbon "0.3.0-SNAPSHOT"]] | ||
|
||
:plugins [[lein-figwheel "0.5.8"] | ||
[lein-cljsbuild "1.1.5" :exclusions [[org.clojure/clojure]]]] | ||
|
||
:source-paths ["src"] | ||
|
||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"] | ||
|
||
:cljsbuild {:builds | ||
[{:id "dev" | ||
:source-paths ["src"] | ||
|
||
;; the presence of a :figwheel configuration here | ||
;; will cause figwheel to inject the figwheel client | ||
;; into your build | ||
:figwheel {:on-jsload "counter.core/on-js-reload" | ||
;; :open-urls will pop open your application | ||
;; in the default browser once Figwheel has | ||
;; started and complied your application. | ||
;; Comment this out once it no longer serves you. | ||
:open-urls ["http://localhost:3449/index.html"]} | ||
|
||
:compiler {:main counter.core | ||
:asset-path "js/compiled/out" | ||
:output-to "resources/public/js/compiled/counter.js" | ||
:output-dir "resources/public/js/compiled/out" | ||
:source-map-timestamp true | ||
;; To console.log CLJS data-structures make sure you enable devtools in Chrome | ||
;; https://github.com/binaryage/cljs-devtools | ||
:preloads [devtools.preload]}} | ||
;; This next build is an compressed minified build for | ||
;; production. You can build this with: | ||
;; lein cljsbuild once min | ||
{:id "min" | ||
:source-paths ["src"] | ||
:compiler {:output-to "resources/public/js/compiled/counter.js" | ||
:main counter.core | ||
:optimizations :advanced | ||
:pretty-print false}}]} | ||
|
||
:figwheel {;; :http-server-root "public" ;; default and assumes "resources" | ||
;; :server-port 3449 ;; default | ||
;; :server-ip "127.0.0.1" | ||
|
||
:css-dirs ["resources/public/css"] ;; watch and update CSS | ||
|
||
;; Start an nREPL server into the running figwheel process | ||
;; :nrepl-port 7888 | ||
|
||
;; Server Ring Handler (optional) | ||
;; if you want to embed a ring handler into the figwheel http-kit | ||
;; server, this is for simple ring servers, if this | ||
|
||
;; doesn't work for you just run your own server :) (see lein-ring) | ||
|
||
;; :ring-handler hello_world.server/handler | ||
|
||
;; To be able to open files in your editor from the heads up display | ||
;; you will need to put a script on your path. | ||
;; that script will have to take a file path and a line number | ||
;; ie. in ~/bin/myfile-opener | ||
;; #! /bin/sh | ||
;; emacsclient -n +$2 $1 | ||
;; | ||
;; :open-file-command "myfile-opener" | ||
|
||
;; if you are using emacsclient you can just use | ||
;; :open-file-command "emacsclient" | ||
|
||
;; if you want to disable the REPL | ||
;; :repl false | ||
|
||
;; to configure a different figwheel logfile path | ||
;; :server-logfile "tmp/logs/figwheel-logfile.log" | ||
} | ||
|
||
|
||
;; setting up nREPL for Figwheel and ClojureScript dev | ||
;; Please see: | ||
;; https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl | ||
|
||
|
||
:profiles {:dev {:dependencies [[binaryage/devtools "0.9.0"] | ||
[figwheel-sidecar "0.5.8"] | ||
[com.cemerick/piggieback "0.2.1"]] | ||
;; need to add dev source path here to get user.clj loaded | ||
:source-paths ["src" "dev"] | ||
;; for CIDER | ||
;; :plugins [[cider/cider-nrepl "0.12.0"]] | ||
:repl-options {; for nREPL dev you really need to limit output | ||
:init (set! *print-length* 50) | ||
:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}} | ||
|
||
) |
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,11 @@ | ||
/* some style */ | ||
button { | ||
width: 6em; | ||
} | ||
|
||
.counter { | ||
margin: 1em; | ||
width: 2em; | ||
text-align: center; | ||
display: inline-block; | ||
} |
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,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="css/style.css" rel="stylesheet" type="text/css"> | ||
<link rel="stylesheet" href="https://unpkg.com/purecss@0.6.2/build/pure-min.css" integrity="sha384-UQiGfs9ICog+LwheBSRCt1o5cbyKIHbwjWscjemyBMT9YCUMZffs6UqUTd0hObXD" crossorigin="anonymous"> | ||
</head> | ||
<body> | ||
<div id="app"> | ||
</div> | ||
<script src="js/compiled/counter.js" type="text/javascript"></script> | ||
</body> | ||
</html> |
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,27 @@ | ||
(ns counter.core | ||
(:require [carbon.vdom :as vdom] | ||
[carbon.rx :as rx :include-macros true])) | ||
|
||
(enable-console-print!) | ||
|
||
;; define your app data so that it doesn't get over-written on reload | ||
|
||
(defonce app-state (rx/cell [0 0])) | ||
|
||
(defn counter [i] | ||
[:div | ||
[:button.pure-button {:on-click #(swap! app-state update i inc)} "Inc"] | ||
[:.counter (get @app-state i)] | ||
[:button.pure-button {:on-click #(swap! app-state update i dec)} "Dec"]]) | ||
|
||
(defn app [] | ||
(for [i (-> @app-state count range)] | ||
^{:key i} [counter i])) | ||
|
||
(vdom/mount [app] (js/document.getElementById "app")) | ||
|
||
(defn on-js-reload [] | ||
;; optionally touch your app-state to force rerendering depending on | ||
;; your application | ||
;; (swap! app-state update-in [:__figwheel_counter] inc) | ||
) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
(defproject carbon "0.2.0-SNAPSHOT" | ||
(defproject carbon "0.3.0-SNAPSHOT" | ||
:description "Yet another VDOM FRP library" | ||
:url "https://github.com/ul/carbon" | ||
:license {:name "Eclipse Public License" | ||
:url "http://www.eclipse.org/legal/epl-v10.html"} | ||
|
||
:dependencies [[org.clojure/clojure "1.9.0-alpha13"] | ||
[org.clojure/clojurescript "1.9.229"] | ||
[carbon/rx "0.2.0-SNAPSHOT"]] | ||
:dependencies [[org.clojure/clojure "1.9.0-alpha14"] | ||
[org.clojure/clojurescript "1.9.456"] | ||
[cljsjs/inferno "1.2.2-0"] | ||
[funcool/cuerdas "2.0.2"] | ||
[carbon/rx "0.3.0-SNAPSHOT"]] | ||
|
||
:source-paths ["src"]) |
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
Oops, something went wrong.