Skip to content

Commit b911873

Browse files
committed
Add 'examples/lein/' from commit '33cf2863b843f798652beae18f627f6ec364bae1'
git-subtree-dir: examples/lein git-subtree-mainline: b866223 git-subtree-split: 33cf286
2 parents b866223 + 33cf286 commit b911873

File tree

36 files changed

+1378
-0
lines changed

36 files changed

+1378
-0
lines changed

examples/lein/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/.cljs_rhino_repl
2+
/.lein-env
3+
pom.xml
4+
*jar
5+
/lib/
6+
/classes/
7+
/out/
8+
/target/
9+
.lein-deps-sum
10+
.lein-repl-history
11+
.lein-plugins/
12+
.repl*
13+
/checkouts*
14+
/resources/public/.compiled
15+
.idea
16+
*.iml
17+
.figwheel/server.log
18+
.nrepl-port
19+
/.dirac-chrome-profile/
20+
/.figwheel/

examples/lein/license.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) BinaryAge Limited and contributors:
2+
https://github.com/binaryage/cljs-devtools-sample/graphs/contributors
3+
4+
MIT License
5+
6+
Permission is hereby granted, free of charge, to any person obtaining
7+
a copy of this software and associated documentation files (the
8+
"Software"), to deal in the Software without restriction, including
9+
without limitation the rights to use, copy, modify, merge, publish,
10+
distribute, sublicense, and/or sell copies of the Software, and to
11+
permit persons to whom the Software is furnished to do so, subject to
12+
the following conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

examples/lein/project.clj

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
(def figwheel-version "0.5.17")
2+
(def environ-version "1.1.0")
3+
(defproject binaryage/devtools-sample "0.1.0-SNAPSHOT"
4+
:description "An example integration of cljs-devtools"
5+
:url "https://github.com/binaryage/cljs-devtools-sample"
6+
7+
:dependencies [[org.clojure/clojure "1.9.0"]
8+
[org.clojure/clojurescript "1.10.439"]
9+
[org.clojure/core.async "0.4.490"]
10+
[binaryage/devtools "0.9.10"]
11+
[binaryage/dirac "RELEASE"]
12+
[com.cognitect/transit-clj "0.8.313"]
13+
[cljs-http "0.1.45"]
14+
[environ ~environ-version]
15+
[figwheel ~figwheel-version]]
16+
17+
:plugins [[lein-cljsbuild "1.1.7"]
18+
[lein-figwheel ~figwheel-version]
19+
[lein-shell "0.5.0"]
20+
[lein-environ ~environ-version]]
21+
22+
; =========================================================================================================================
23+
24+
:source-paths ["src/demo"
25+
"src/debug"
26+
"src/tests"
27+
"src/advanced-unconditional-install"
28+
"src/advanced-conditional-install"
29+
"src/advanced-no-install"]
30+
31+
:clean-targets ^{:protect false} ["resources/public/.compiled"
32+
"target"]
33+
34+
:checkout-deps-shares ^:replace [] ; http://jakemccrary.com/blog/2015/03/24/advanced-leiningen-checkouts-configuring-what-ends-up-on-your-classpath/
35+
36+
; =========================================================================================================================
37+
38+
:cljsbuild {:builds {}} ; prevent https://github.com/emezeske/lein-cljsbuild/issues/413
39+
40+
:profiles {; --------------------------------------------------------------------------------------------------------------
41+
:demo
42+
{:cljsbuild {:builds {:demo
43+
{:source-paths ["src/demo"
44+
"src/tests"]
45+
:compiler {:output-to "resources/public/.compiled/demo/devtools_sample.js"
46+
:output-dir "resources/public/.compiled/demo"
47+
:asset-path ".compiled/demo"
48+
:main devtools-sample.boot
49+
:preloads [devtools.preload]
50+
:optimizations :none
51+
:source-map true}}}}}
52+
; --------------------------------------------------------------------------------------------------------------
53+
:demo-advanced
54+
{:cljsbuild {:builds {:demo-advanced
55+
{:source-paths ["src/demo"
56+
"src/tests"]
57+
:compiler {:output-to "resources/public/.compiled/demo_advanced/devtools_sample.js"
58+
:output-dir "resources/public/.compiled/demo_advanced"
59+
:asset-path ".compiled/demo_advanced"
60+
:pseudo-names true
61+
:optimizations :advanced}}}}}
62+
; --------------------------------------------------------------------------------------------------------------
63+
:advanced-unconditional-install
64+
{:cljsbuild {:builds {:advanced-unconditional-install
65+
{:source-paths ["src/advanced-unconditional-install"]
66+
:compiler {:output-to "resources/public/.compiled/advanced-unconditional-install/devtools_sample.js"
67+
:output-dir "resources/public/.compiled/advanced-unconditional-install"
68+
:asset-path ".compiled/advanced-unconditional-install"
69+
:closure-defines {"goog.DEBUG" false}
70+
:pseudo-names true
71+
:optimizations :advanced}}}}}
72+
; --------------------------------------------------------------------------------------------------------------
73+
:advanced-conditional-install
74+
{:cljsbuild {:builds {:advanced-conditional-install
75+
{:source-paths ["src/advanced-conditional-install"]
76+
:compiler {:output-to "resources/public/.compiled/advanced-conditional-install/devtools_sample.js"
77+
:output-dir "resources/public/.compiled/advanced-conditional-install"
78+
:asset-path ".compiled/advanced-conditional-install"
79+
:closure-defines {"goog.DEBUG" false}
80+
:pseudo-names true
81+
:optimizations :advanced}}}}}
82+
; --------------------------------------------------------------------------------------------------------------
83+
:advanced-no-install
84+
{:cljsbuild {:builds {:advanced-no-install
85+
{:source-paths ["src/advanced-no-install"]
86+
:compiler {:output-to "resources/public/.compiled/advanced-no-install/devtools_sample.js"
87+
:output-dir "resources/public/.compiled/advanced-no-install"
88+
:asset-path ".compiled/advanced-no-install"
89+
:closure-defines {"goog.DEBUG" false}
90+
:pseudo-names true
91+
:optimizations :advanced}}}}}
92+
; --------------------------------------------------------------------------------------------------------------
93+
:checkouts
94+
{:checkout-deps-shares ^:replace [:source-paths
95+
:test-paths
96+
:resource-paths
97+
:compile-path
98+
#=(eval leiningen.core.classpath/checkout-deps-paths)]
99+
:cljsbuild {:builds {:demo
100+
{:source-paths ["checkouts/cljs-devtools/src/lib"]}}}}
101+
; --------------------------------------------------------------------------------------------------------------
102+
:figwheel
103+
{:figwheel {:server-port 7000
104+
:server-logfile ".figwheel/server.log"
105+
:validate-config false}
106+
:cljsbuild {:builds {:demo
107+
{:figwheel true}}}}
108+
; --------------------------------------------------------------------------------------------------------------
109+
:devel
110+
{:env {:devtools-debug "true"}
111+
:cljsbuild {:builds {:demo
112+
{:source-paths ["src/debug"
113+
"checkouts/cljs-devtools/src/debug"]}}}}}
114+
115+
; =========================================================================================================================
116+
117+
:aliases {"demo" ["with-profile" "+demo,+figwheel" "figwheel"]
118+
"demo-advanced" ["with-profile" "+demo-advanced" "do"
119+
["cljsbuild" "once"]
120+
["shell" "scripts/dev-server.sh"]]
121+
"cljs" ["with-profile" "+demo" "cljsbuild" "auto"]
122+
"present" ["with-profile" "+demo" "do"
123+
["clean"]
124+
["cljsbuild" "once"]
125+
["shell" "scripts/dev-server.sh"]]
126+
"advanced-unconditional-install" ["with-profile" "+advanced-unconditional-install" "cljsbuild" "once"]
127+
"advanced-conditional-install" ["with-profile" "+advanced-conditional-install" "cljsbuild" "once"]
128+
"advanced-no-install" ["with-profile" "+advanced-no-install" "cljsbuild" "once"]
129+
"advanced-compare" ["do"
130+
["clean"]
131+
["advanced-unconditional-install"]
132+
["advanced-conditional-install"]
133+
["advanced-no-install"]
134+
["shell" "scripts/compare-advanced-builds.sh"]]
135+
"devel" ["with-profile" "+demo,+checkouts,+devel,+figwheel" "figwheel"]})

examples/lein/readme.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# cljs-devtools-sample [![GitHub license](https://img.shields.io/github/license/binaryage/cljs-devtools-sample.svg)](license.txt)
2+
3+
This project is an example of integration of [**cljs-devtools**](https://github.com/binaryage/cljs-devtools) into a
4+
Leiningen-based ClojureScript project.
5+
6+
![](https://box.binaryage.com/cljs-devtools-sample-full.png)
7+
8+
## Local setup
9+
10+
git clone https://github.com/binaryage/cljs-devtools-sample.git
11+
cd cljs-devtools-sample
12+
13+
Build the project and start local demo server:
14+
15+
lein demo
16+
17+
* A demo page should be available at [http://localhost:7000](http://localhost:7000).
18+
* Please visit it with Google Chrome browser with [enabled custom formatters](https://github.com/binaryage/cljs-devtools).
19+
* Open the web development console under devtools and you should see something similar to the screenshot above.
20+
Note: you might need to refresh the page again to force re-rendering of custom formatters after opening the console.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
html {
2+
font-family: Menlo, monospace;
3+
font-size: 11px
4+
}
5+
6+
html, body {
7+
height:100%;
8+
}
9+
10+
body, html, code, pre {
11+
padding: 0;
12+
margin: 0
13+
}
14+
15+
pre {
16+
background-color: #1d1f21;
17+
height: 100%;
18+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
3+
vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid)
4+
5+
*/
6+
7+
/*background color*/
8+
.hljs {
9+
display: block;
10+
overflow-x: auto;
11+
padding: 0.5em;
12+
background: #1d1f21;
13+
}
14+
15+
/*selection color*/
16+
.hljs::selection,
17+
.hljs span::selection {
18+
background: #373b41;
19+
}
20+
21+
.hljs::-moz-selection,
22+
.hljs span::-moz-selection {
23+
background: #373b41;
24+
}
25+
26+
/*foreground color*/
27+
.hljs {
28+
color: #c5c8c6;
29+
}
30+
31+
/*color: fg_yellow*/
32+
.hljs-title,
33+
.hljs-name {
34+
color: #f0c674;
35+
}
36+
37+
/*color: fg_comment*/
38+
.hljs-comment,
39+
.hljs-meta,
40+
.hljs-meta .hljs-keyword {
41+
color: #707880;
42+
}
43+
44+
/*color: fg_red*/
45+
.hljs-number,
46+
.hljs-symbol,
47+
.hljs-literal,
48+
.hljs-deletion,
49+
.hljs-link {
50+
color: #cc6666
51+
}
52+
53+
/*color: fg_green*/
54+
.hljs-string,
55+
.hljs-doctag,
56+
.hljs-addition,
57+
.hljs-regexp,
58+
.hljs-selector-attr,
59+
.hljs-selector-pseudo {
60+
color: #b5bd68;
61+
}
62+
63+
/*color: fg_purple*/
64+
.hljs-attribute,
65+
.hljs-code,
66+
.hljs-selector-id {
67+
color: #b294bb;
68+
}
69+
70+
/*color: fg_blue*/
71+
.hljs-keyword,
72+
.hljs-selector-tag,
73+
.hljs-bullet,
74+
.hljs-tag {
75+
color: #81a2be;
76+
}
77+
78+
/*color: fg_aqua*/
79+
.hljs-subst,
80+
.hljs-variable,
81+
.hljs-template-tag,
82+
.hljs-template-variable {
83+
color: #8abeb7;
84+
}
85+
86+
/*color: fg_orange*/
87+
.hljs-type,
88+
.hljs-built_in,
89+
.hljs-builtin-name,
90+
.hljs-quote,
91+
.hljs-section,
92+
.hljs-selector-class {
93+
color: #de935f;
94+
}
95+
96+
.hljs-emphasis {
97+
font-style: italic;
98+
}
99+
100+
.hljs-strong {
101+
font-weight: bold;
102+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>CLJS DevTools Sample</title>
5+
<link rel="stylesheet" href="css/hybrid.css">
6+
<link rel="stylesheet" href="css/base.css">
7+
</head>
8+
<body>
9+
<pre><code></code></pre>
10+
<script src="js/highlight.pack.js" type="text/javascript"></script>
11+
<script src=".compiled/demo/devtools_sample.js" type="text/javascript"></script>
12+
<script>
13+
goog.require('devtools_sample.core');
14+
</script>
15+
<br>
16+
<button onclick="devtools_sample.core.sanity_test_handler()">sanity test</button>
17+
<button onclick="devtools_sample.core.breakpoint_test_handler()">breakpoint test</button>
18+
</body>
19+
</html>

0 commit comments

Comments
 (0)