├── .github └── issue_template.md ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build_docs.sh ├── code_of_conduct.md ├── doc ├── .gitignore ├── 01_00_getting_started.md ├── 01_01_list_of_contents.md ├── 01_02_invoking_chestnut.md ├── 02_00_recipes.md ├── 02_01_alternatives_to_om_dom.md ├── 02_02_testing.md ├── 03_00_developer_notes.md ├── FAQ.md ├── GLOSSARY.md ├── README.md ├── SUMMARY.md ├── book.json ├── img │ └── hello_chestnut.png └── testing.md ├── project.clj ├── repl └── ancient.clj ├── resources ├── DSTRootCAX3.crt ├── chestnut.eps ├── chestnut.png ├── chestnut.svg └── favicon.ico └── src ├── chestnut ├── httpclient.clj └── test │ ├── integration.clj │ └── scratch.clj ├── leiningen └── new │ ├── chestnut.clj │ └── chestnut │ ├── .dir-locals.el │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── Procfile │ ├── README.md │ ├── code_of_conduct.md │ ├── dev │ ├── cljs │ │ └── user.cljs │ └── user.clj │ ├── project.clj │ ├── resources │ ├── log4j.properties │ └── public │ │ ├── css │ │ └── style.css │ │ ├── favicon.ico │ │ └── index.html │ ├── src │ ├── clj │ │ └── chestnut │ │ │ ├── application.clj │ │ │ ├── components │ │ │ ├── server_info.clj │ │ │ └── shell_component.clj │ │ │ ├── config.clj │ │ │ ├── routes.clj │ │ │ └── styles.clj │ ├── cljc │ │ └── chestnut │ │ │ └── common.cljc │ ├── cljs │ │ └── chestnut │ │ │ ├── components │ │ │ └── ui.cljs │ │ │ ├── core_om_next.cljs │ │ │ ├── core_re_frame.cljs │ │ │ ├── core_reagent.cljs │ │ │ ├── core_rum.cljs │ │ │ ├── core_vanilla.cljs │ │ │ └── system.cljs │ ├── less │ │ └── style.less │ └── scss │ │ └── style.scss │ ├── system.properties │ └── test │ ├── clj │ └── chestnut │ │ └── example_test.clj │ ├── cljc │ └── chestnut │ │ └── common_test.cljc │ └── cljs │ └── chestnut │ ├── core_test.cljs │ └── test_runner.cljs └── mistletoe ├── process.clj └── test.clj /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 7 | 8 | - [ ] I am reporting a bug or problem in Chestnut 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.lein-* 9 | /.nrepl-port 10 | /.repl 11 | /out 12 | resources/public 13 | .swp 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog 2 | 3 | ### [0.19.0] (unreleased) 4 | 5 | - Bring back `+reagent` / `--reagent` for compatibility 6 | 7 | ### [0.18.0] - 2019-04-03 8 | 9 | - Update CIDER vars in dir-locals.el 10 | - Bump Piggieback for latest jvm support 11 | 12 | ### [0.17.0] - 2019-01-01 13 | 14 | - Drop Om, replace Reagent as the default UI library 15 | - Update critically breaking dependencies 16 | - Add javax xml bind dependency to fix Java 9+ compatability 17 | - Explicitly add dotfiles to project for lein compatability 18 | - Bump dependencies so project flags work out of the box 19 | 20 | ### [0.16.0] - 2018-05-06 21 | 22 | - Add `+edge` and `+bleeding-edge` options for automatically using the latest version of dependencies. 23 | - Upgrade ClojureScript, Om, Reagent, lein-cljsbuild, Figwheel 24 | - Fix middleware order so static files correctly have their media type set 25 | - Bring back logging to file, using [clj-logging-config](https://github.com/malcolmsparks/clj-logging-config) 26 | - Add a help screen (`+help` or when using any unrecognized options) 27 | - Set `goog.DEBUG` to `false` in the production ClojureScript build 28 | - Fix lein 1.8 compatability 29 | - Fix Procfile rendering 30 | 31 | ### [0.15.2] - 2017-07-30 32 | 33 | - Update more docs to refer to `(go)` and `(cljs-repl)` instead of `(run)` and `(browser-repl)` 34 | - Fix less and sass support 35 | - Fix `index.html` generation when project name contains an underscore 36 | - Upgrade several versions (ClojureScript, Ring, lein-cljsbuild, re-frame, piggieback, ring.middleware.logger) 37 | 38 | ### [0.15.1] - 2017-05-29 39 | 40 | - Make the pop-poll work by shelling out to curl 41 | 42 | ### [0.15.0] - 2017-05-29 43 | 44 | - Add Component support, both backend and frontend 45 | - Add a `+re-frame` flag, for [re-frame](https://github.com/Day8/re-frame) projects 46 | - remove `:repl-options {:init (go)}` from `project.clj`. You'll have to call `(go)` yourself after starting a REPL 47 | - clean up the SASS/LESS support. It's still a hack, but a slightly cleaner hack 48 | - Make `code_of_conduct.md` optional (`+coc` or `+code-of-conduct` flag to add it back) 49 | - Make `browser-repl` and `run` deprecated, in favor of `cljs-repl` and `go` 50 | - Collect usage statistics (version + command line flags). It is possible to opt-out with `+no-poll`. 51 | - Bump versions: clojurescript 1.9.562, transit-clj 0.8.300, ring 1.6.1, ring-defaults 0.3.0, compojure 1.6.0, figwheel 0.5.10, figwheel-sidecar 0.5.10, org.clojure/tools.nrepl 0.2.13, om 1.0.0-alpha48 52 | 53 | ### 0.15.0-SNAPSHOT 54 | 55 | - Options now use `+` as a prefix instead of `--`. This is more in line with 56 | other popular templates like Luminus, and it stops Leiningen from eating our 57 | options. The `--` variants still work. 58 | - Add Rum support. Use (`+rum`). 59 | - Add Om Next support. Use (`+om-next`). 60 | - Bump versions: clojurescript 1.9.293, transit-clj 0.8.297, ring 1.5.0, ring-defaults 0.2.1, compojure 1.5.1, environ 1.1.0, reagent 0.6.0, figwheel 0.5.8, http-kit 2.2.0, om 1.0.0-alpha47, doo 0.1.7, lein-cljsbuild 1.1.5, lein-environ 1.1.0 61 | 62 | ### [0.14.0] - 2016-06-23 63 | 64 | - Add cljc support 65 | - ClojureScript 1.9.89 66 | - Figwheel 0.5.4-4 67 | 68 | ### [0.13.0] - 2016-06-13 69 | 70 | - Clojurescript 1.9.36 71 | - Include Transit for faster ClojureScript compilation 72 | - Figwheel 0.5.4-2 73 | - Reagent 0.6.0-rc 74 | - Om 1.0.0-alpha36 75 | - Avoid using Leiningen profile merging for `:cljsbuild` configs 76 | 77 | ### [0.12.0] - 2016-05-24 78 | 79 | * Upgrades 80 | * org.omcljs/om 1.0.0-alpha31 => 1.0.0-alpha35 81 | * lein-auto 0.1.1 => 0.1.2 82 | * lein-less 1.7.3 => 1.7.5 83 | * org.clojure/clojurescript 1.8.40 => 1.8.51 84 | * environ 1.0.2 => 1.0.3 85 | * lein-cljsbuild 1.1.1 => 1.1.3 86 | * lein-environ 1.0.1 => 1.0.3 87 | * figwheel 0.5.2 => 0.5.3-2 88 | * Only add "dev" to the classpath in dev mode, fixes an issue with `lein jar` 89 | 90 | ### [0.11.0] - 2016-03-28 91 | 92 | * Upgrade ClojureScript 1.7.228 => 1.8.40 93 | * Upgrade Figwheel 0.5.1 => 0.5.2 94 | 95 | ### [0.10.1] - 2016-03-27 96 | 97 | * Fix missing dependency when using `--http-kit` 98 | 99 | ### 0.10.0 - 2016-03-24 100 | 101 | * Add switches for --reagent and --vanilla 102 | * Upgrade Figwheel to 0.5.1 103 | * Upgrade to Clojure 1.8.0, Om 1.1.0-alpha31, ring-defaults 0.2.0, compojure 1.5.0 104 | 105 | ### v0.9.1 - 2016-02-02 106 | 107 | * Upgrade Figwheel to 0.5.0-6 108 | * Upgrade Environ to 1.0.2 109 | * Upgrade internal dependencies to play better with Boot 110 | 111 | ### v0.9.0 - 2016-01-29 112 | 113 | * Use Figwheel for REPL and Ring server 114 | * Remove boilerplate that's no longer needed 115 | * Drop Enlive and simplify the dev setup 116 | * Drop CLJX support 117 | * Better inline documentation 118 | * Upgrade all dependencies 119 | 120 | ### v0.8.2-SNAPSHOT 121 | * Version upgrades: clojurescript: 1.7.145 => 1.7.189, om: 1.0.0-alpha15 => 1.0.0-alpha28, figwheel => 0.4.1, figwheel-sidecar 0.4.1 => 0.5.0-2, lein-figwheel 0.4.1 => 0.5.0-2 122 | * Version upgrades: clojurescript: 1.7.122 => 1.7.145, om: 0.9.0 => 1.0.0-alpha15, tools.nrepl => 0.2.12, figwheel => 0.4.1, figwheel-sidecar => 0.4.1, lein-figwheel => 0.4.1,environ => 1.0.1, lein-environ => 1.0.1 123 | * Fix allowing projects to have - in their names. 124 | * Fix allowing groupID/artifactID naming convention. 125 | * Fix "No such namespace" when using om via the REPL. 126 | * Fix specljs auto testing. 127 | * Added gzip compression using [ring.middleware.gzip](https://github.com/bertrandk/ring-gzip). 128 | * Added browser cache-control hinting using [ring.middleware.browser-caching](https://github.com/slester/browser-caching). 129 | * Version upgrades: clojure: 1.6.0 => 1.7.0, clojurescript: 0.0-3058 => 1.7.48, ring: 1.3.2 => 1.4.0, ring-defaults: 0.1.4 => 0.1.5, compojure: 1.3.2 => 1.4.0, om: 0.8.8 => 0.9.0, figwheel: 0.2.5 => 0.3.7, piggieback: 0.1.5 => 0.2.1, weasel: 0.6.0 => 0.7.0 130 | 131 | ### v0.8.1 132 | 133 | * Restore working lein repl for cljx projects ([Josh Daghlian](https://github.com/jcdcodes)) 134 | * Use latest version of enlive to fix windows issue ([Justin Squirek](https://github.com/AdaDoom3)) 135 | 136 | ### v0.8.0 137 | 138 | * Update Om: 0.8.0-rc1 => 0.8.8 ([Anna Pawlicka](https://github.com/annapawlicka)) 139 | * Make Uberjar executable ([Børge Svingen](https://github.com/bsvingen)) 140 | * Remove react.js injection in dev html ([Jamie English](https://github.com/english)) 141 | * Fix how Less and Sassc are invoked ([Daryl Lau](https://github.com/dlau)) 142 | * Fix in figwheel config ([Tim Gilbert](https://github.com/timgilbert)), ([Philip Joseph](https://github.com/lambdahands)), ([Antony Woods](https://github.com/acron0)) 143 | * Fix in test setup ([Geoff Shannon](https://github.com/RadicalZephyr)) 144 | * Doc fixes ([Anthony Rosequist](https://github.com/arosequist)) 145 | * Version upgrades: clojurescript: 0.0-2511 => 0.0-3058 ; figwheel: 0.2.1-SNAPSHOT => 0.2.5 ; weasel: 0.4.2 => 0.6.0 and more 146 | 147 | ### v0.7.0 - 2015-03-06 148 | 149 | * Added Clojure{,script} unit testing support with Phantom JS. 150 | ([Rory Gibson](https://github.com/rorygibson)) 151 | * Update om-tools: 0.3.9 => 0.3.10 152 | * Update ring-defaults: 0.1.2 => 0.1.3 153 | * Use figwheel-sidecar, drop the dependency on leiningen 154 | * renamed the per-env namespace from dev to main 155 | * give a proper error message when trying to invoke less in production 156 | 157 | ### v0.7.0-SNAPSHOT-20150103 - 2015-01-03 158 | 159 | * Validate command line arguments 160 | * Mention Chestnut version in the generated README 161 | * Fix om-tools support 162 | * SASSC support has been fixed, but is considered undocumented and unsupported 163 | * Update Om: 0.7.0 => 0.8.0-rc1 164 | * Add Code of Conduct to generated projects 165 | * Update CLJX: 0.4.0 => 0.5.0 166 | * Update Clojurescript: 0.0-2496 => 0.0-2644 167 | * Fixes for regressions: [#71](https://github.com/plexus/chestnut/pull/71) 168 | 169 | ### v0.7.0-SNAPSHOT-20141226 - 2014-12-26 170 | 171 | * Update Clojurescript: 0.0-2371 => 0.0-2496 172 | * Update Compojure: 1.2.0 => 1.3.1 173 | * Update Om: 0.7.0 => 0.8.0-beta3 174 | * Fixes for regressions: [#65](https://github.com/plexus/chestnut/pull/65) [#57](https://github.com/plexus/chestnut/pull/57) 175 | 176 | ### v0.7.0-SNAPSHOT-20141207 - 2014-12-07 177 | 178 | * Make weasel print both to the REPL and the browser console 179 | ([Marcus Lewis](https://github.com/mrcslws)) 180 | * Add support for the LESS CSS pre-processor 181 | ([Denis Golovnev](https://github.com/teur)) 182 | * Enable auto-reload of enlive templates in dev mode 183 | ([Ray H](https://github.com/rymndhng)) 184 | * Add support for the SASS CSS pre-processor 185 | ([Edward Wible](https://github.com/aew)) 186 | * Add suport for Speclj ([Edward Wible](https://github.com/aew)) 187 | * Switch from the deprecated compojure.handler to ring-defaults 188 | [zakak](https://github.com/zakak)) 189 | * Keep dev dependencies (Leiningen, Figwheel, Weasel, Speclj) out of 190 | the Uberjar 191 | * Automatically switch the browser-repl to the right namespace after 192 | starting up, instead of `cljs.user` 193 | * No longer include lein-ancient, easy enough to add for those that 194 | want it 195 | * Update Ring: 1.3.1 => 1.3.2 196 | * Update Figwheel: 0.1.4-SNAPSHOT => 0.1.6-SNAPSHOT 197 | * Update Weasel: 0.4.0-SNAPSHOT => 0.4.2 198 | 199 | ### v0.6.0 - 2014-10-29 200 | 201 | * Add optional support for CLJX 202 | ([Olli Piepponen](https://github.com/luxbock)) 203 | * Support generation of projects named using the groupId/artifactId 204 | convention (e.g. com.example/foo) 205 | ([Steeve Beliveau](https://github.com/stebel)) 206 | 207 | ### v0.5.0 - 2014-10-10 208 | 209 | * Run figwheel inside `(run)` so we only need one process 210 | * Configure figwheel's CSS reloading and load a placeholder 211 | `style.css` 212 | * Refresh Om when Figwheel reloads 213 | * Update ClojureScript: 0.0-2342 => 0.0-2371 214 | * Update Compojure: 1.1.9 => 1.2.0 215 | * Update Om: 0.7.1 => 0.7.3 216 | * No longer depend on Weasel in production mode 217 | 218 | ### v0.4.0 - 2014-09-27 219 | 220 | * Option to switch to HTTP Kit for a web server 221 | * Add reloading middleware 222 | * Add default compojure.handler.site middleware 223 | 224 | ### v0.3.0 - 2014-09-26 225 | 226 | * Switched to Weasel for Austin 227 | * Optimized uberjar 228 | * Fix usage of {{name}}/{{sanitized}} 229 | * Load react from the jar, instead of from Facebook's CDN 230 | * Update dependencies (Clojurescript, Ring, Compojure, Environ) 231 | 232 | ### v0.2.0 - 2014-09-21 233 | 234 | * Uberjar support 235 | * Heroku support (Procfile, system.properties) 236 | * added .gitignore 237 | * First version of development/production modes 238 | 239 | ### v0.1.0 - 2015-09-19 240 | 241 | * First release, containing Austin, Figwheel, Om 242 | 243 | [Unreleased]: https://github.com/plexus/chestnut/compare/v0.15.2...HEAD 244 | [0.15.2]: https://github.com/plexus/chestnut/compare/v0.15.1...v0.15.2 245 | [0.15.1]: https://github.com/plexus/chestnut/compare/v0.15.0...v0.15.1 246 | [0.15.0]: https://github.com/plexus/chestnut/compare/v0.14.0...v0.15.0 247 | [0.14.0]: https://github.com/plexus/chestnut/compare/v0.13.0...v0.14.0 248 | [0.13.0]: https://github.com/plexus/chestnut/compare/v0.12.0...v0.13.0 249 | [0.12.0]: https://github.com/plexus/chestnut/compare/v0.11.0...v0.12.0 250 | [0.11.0]: https://github.com/plexus/chestnut/compare/v0.10.1...v0.11.0 251 | [0.10.1]: https://github.com/plexus/chestnut/compare/v0.10.0...v0.10.1 252 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC 2 | LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM 3 | CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 4 | 5 | 1. DEFINITIONS 6 | 7 | "Contribution" means: 8 | 9 | a) in the case of the initial Contributor, the initial code and 10 | documentation distributed under this Agreement, and 11 | 12 | b) in the case of each subsequent Contributor: 13 | 14 | i) changes to the Program, and 15 | 16 | ii) additions to the Program; 17 | 18 | where such changes and/or additions to the Program originate from and are 19 | distributed by that particular Contributor. A Contribution 'originates' from 20 | a Contributor if it was added to the Program by such Contributor itself or 21 | anyone acting on such Contributor's behalf. Contributions do not include 22 | additions to the Program which: (i) are separate modules of software 23 | distributed in conjunction with the Program under their own license 24 | agreement, and (ii) are not derivative works of the Program. 25 | 26 | "Contributor" means any person or entity that distributes the Program. 27 | 28 | "Licensed Patents" mean patent claims licensable by a Contributor which are 29 | necessarily infringed by the use or sale of its Contribution alone or when 30 | combined with the Program. 31 | 32 | "Program" means the Contributions distributed in accordance with this 33 | Agreement. 34 | 35 | "Recipient" means anyone who receives the Program under this Agreement, 36 | including all Contributors. 37 | 38 | 2. GRANT OF RIGHTS 39 | 40 | a) Subject to the terms of this Agreement, each Contributor hereby grants 41 | Recipient a non-exclusive, worldwide, royalty-free copyright license to 42 | reproduce, prepare derivative works of, publicly display, publicly perform, 43 | distribute and sublicense the Contribution of such Contributor, if any, and 44 | such derivative works, in source code and object code form. 45 | 46 | b) Subject to the terms of this Agreement, each Contributor hereby grants 47 | Recipient a non-exclusive, worldwide, royalty-free patent license under 48 | Licensed Patents to make, use, sell, offer to sell, import and otherwise 49 | transfer the Contribution of such Contributor, if any, in source code and 50 | object code form. This patent license shall apply to the combination of the 51 | Contribution and the Program if, at the time the Contribution is added by the 52 | Contributor, such addition of the Contribution causes such combination to be 53 | covered by the Licensed Patents. The patent license shall not apply to any 54 | other combinations which include the Contribution. No hardware per se is 55 | licensed hereunder. 56 | 57 | c) Recipient understands that although each Contributor grants the licenses 58 | to its Contributions set forth herein, no assurances are provided by any 59 | Contributor that the Program does not infringe the patent or other 60 | intellectual property rights of any other entity. Each Contributor disclaims 61 | any liability to Recipient for claims brought by any other entity based on 62 | infringement of intellectual property rights or otherwise. As a condition to 63 | exercising the rights and licenses granted hereunder, each Recipient hereby 64 | assumes sole responsibility to secure any other intellectual property rights 65 | needed, if any. For example, if a third party patent license is required to 66 | allow Recipient to distribute the Program, it is Recipient's responsibility 67 | to acquire that license before distributing the Program. 68 | 69 | d) Each Contributor represents that to its knowledge it has sufficient 70 | copyright rights in its Contribution, if any, to grant the copyright license 71 | set forth in this Agreement. 72 | 73 | 3. REQUIREMENTS 74 | 75 | A Contributor may choose to distribute the Program in object code form under 76 | its own license agreement, provided that: 77 | 78 | a) it complies with the terms and conditions of this Agreement; and 79 | 80 | b) its license agreement: 81 | 82 | i) effectively disclaims on behalf of all Contributors all warranties and 83 | conditions, express and implied, including warranties or conditions of title 84 | and non-infringement, and implied warranties or conditions of merchantability 85 | and fitness for a particular purpose; 86 | 87 | ii) effectively excludes on behalf of all Contributors all liability for 88 | damages, including direct, indirect, special, incidental and consequential 89 | damages, such as lost profits; 90 | 91 | iii) states that any provisions which differ from this Agreement are offered 92 | by that Contributor alone and not by any other party; and 93 | 94 | iv) states that source code for the Program is available from such 95 | Contributor, and informs licensees how to obtain it in a reasonable manner on 96 | or through a medium customarily used for software exchange. 97 | 98 | When the Program is made available in source code form: 99 | 100 | a) it must be made available under this Agreement; and 101 | 102 | b) a copy of this Agreement must be included with each copy of the Program. 103 | 104 | Contributors may not remove or alter any copyright notices contained within 105 | the Program. 106 | 107 | Each Contributor must identify itself as the originator of its Contribution, 108 | if any, in a manner that reasonably allows subsequent Recipients to identify 109 | the originator of the Contribution. 110 | 111 | 4. COMMERCIAL DISTRIBUTION 112 | 113 | Commercial distributors of software may accept certain responsibilities with 114 | respect to end users, business partners and the like. While this license is 115 | intended to facilitate the commercial use of the Program, the Contributor who 116 | includes the Program in a commercial product offering should do so in a 117 | manner which does not create potential liability for other Contributors. 118 | Therefore, if a Contributor includes the Program in a commercial product 119 | offering, such Contributor ("Commercial Contributor") hereby agrees to defend 120 | and indemnify every other Contributor ("Indemnified Contributor") against any 121 | losses, damages and costs (collectively "Losses") arising from claims, 122 | lawsuits and other legal actions brought by a third party against the 123 | Indemnified Contributor to the extent caused by the acts or omissions of such 124 | Commercial Contributor in connection with its distribution of the Program in 125 | a commercial product offering. The obligations in this section do not apply 126 | to any claims or Losses relating to any actual or alleged intellectual 127 | property infringement. In order to qualify, an Indemnified Contributor must: 128 | a) promptly notify the Commercial Contributor in writing of such claim, and 129 | b) allow the Commercial Contributor tocontrol, and cooperate with the 130 | Commercial Contributor in, the defense and any related settlement 131 | negotiations. The Indemnified Contributor may participate in any such claim 132 | at its own expense. 133 | 134 | For example, a Contributor might include the Program in a commercial product 135 | offering, Product X. That Contributor is then a Commercial Contributor. If 136 | that Commercial Contributor then makes performance claims, or offers 137 | warranties related to Product X, those performance claims and warranties are 138 | such Commercial Contributor's responsibility alone. Under this section, the 139 | Commercial Contributor would have to defend claims against the other 140 | Contributors related to those performance claims and warranties, and if a 141 | court requires any other Contributor to pay any damages as a result, the 142 | Commercial Contributor must pay those damages. 143 | 144 | 5. NO WARRANTY 145 | 146 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON 147 | AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER 148 | EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR 149 | CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A 150 | PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the 151 | appropriateness of using and distributing the Program and assumes all risks 152 | associated with its exercise of rights under this Agreement , including but 153 | not limited to the risks and costs of program errors, compliance with 154 | applicable laws, damage to or loss of data, programs or equipment, and 155 | unavailability or interruption of operations. 156 | 157 | 6. DISCLAIMER OF LIABILITY 158 | 159 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY 160 | CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, 161 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION 162 | LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 163 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 164 | ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE 165 | EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY 166 | OF SUCH DAMAGES. 167 | 168 | 7. GENERAL 169 | 170 | If any provision of this Agreement is invalid or unenforceable under 171 | applicable law, it shall not affect the validity or enforceability of the 172 | remainder of the terms of this Agreement, and without further action by the 173 | parties hereto, such provision shall be reformed to the minimum extent 174 | necessary to make such provision valid and enforceable. 175 | 176 | If Recipient institutes patent litigation against any entity (including a 177 | cross-claim or counterclaim in a lawsuit) alleging that the Program itself 178 | (excluding combinations of the Program with other software or hardware) 179 | infringes such Recipient's patent(s), then such Recipient's rights granted 180 | under Section 2(b) shall terminate as of the date such litigation is filed. 181 | 182 | All Recipient's rights under this Agreement shall terminate if it fails to 183 | comply with any of the material terms or conditions of this Agreement and 184 | does not cure such failure in a reasonable period of time after becoming 185 | aware of such noncompliance. If all Recipient's rights under this Agreement 186 | terminate, Recipient agrees to cease use and distribution of the Program as 187 | soon as reasonably practicable. However, Recipient's obligations under this 188 | Agreement and any licenses granted by Recipient relating to the Program shall 189 | continue and survive. 190 | 191 | Everyone is permitted to copy and distribute copies of this Agreement, but in 192 | order to avoid inconsistency the Agreement is copyrighted and may only be 193 | modified in the following manner. The Agreement Steward reserves the right to 194 | publish new versions (including revisions) of this Agreement from time to 195 | time. No one other than the Agreement Steward has the right to modify this 196 | Agreement. The Eclipse Foundation is the initial Agreement Steward. The 197 | Eclipse Foundation may assign the responsibility to serve as the Agreement 198 | Steward to a suitable separate entity. Each new version of the Agreement will 199 | be given a distinguishing version number. The Program (including 200 | Contributions) may always be distributed subject to the version of the 201 | Agreement under which it was received. In addition, after a new version of 202 | the Agreement is published, Contributor may elect to distribute the Program 203 | (including its Contributions) under the new version. Except as expressly 204 | stated in Sections 2(a) and 2(b) above, Recipient receives no rights or 205 | licenses to the intellectual property of any Contributor under this 206 | Agreement, whether expressly, by implication, estoppel or otherwise. All 207 | rights in the Program not expressly granted under this Agreement are 208 | reserved. 209 | 210 | This Agreement is governed by the laws of the State of New York and the 211 | intellectual property laws of the United States of America. No party to this 212 | Agreement will bring a legal action under this Agreement more than one year 213 | after the cause of action arose. Each party waives its rights to a jury trial 214 | in any resulting litigation. 215 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # chestnut 2 | 3 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/plexus/chestnut?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | [![Clojureverse](https://rawgit.com/clojureverse/clojureverse-assets/master/clojureverse-org-green.svg)](https://clojureverse.org/c/projects/chestnut) 5 | 6 | [![Clojars Project](http://clojars.org/chestnut/lein-template/latest-version.svg)](http://clojars.org/chestnut/lein-template) 7 | 8 | Mr. Chestnut 9 | 10 | 11 | **Getting value out of Chestnut? Consider making [a small donation](https://patreon.com/plexus).** 12 | 13 | Chestnut is a Clojure/ClojureScript application template. It takes the pain out 14 | of getting a working ClojureScript setup with live reloading plus a browser 15 | connected REPL. 16 | 17 | It provides a solid default configuration for a REPL driven workflow, a 18 | ClojureScript setup with separate dev/prod/test builds, Figwheel integration, 19 | and a basic setup for running CLJ and CLJS unit tests. It provides a basic web 20 | backend setup with Compojure, and a frontend based on one of the React wrappers 21 | (your choice of Reagent, Rum, om-next, re-frame, or Vanilla JS). It works out of the 22 | box on popular cloud providers like Heroku. 23 | 24 | While Chestnut it's quite "complete" in a sense, it also tries to be minimal. 25 | Boilerplate code is kept to a minimum, and there is only just enough structure 26 | to get you started. How you build and structure your app from there is up to 27 | you. 28 | 29 | Chestnut should appeal to beginners because it allows you to get started quickly 30 | and with minimal baggage, it should appeal to more seasoned developers because 31 | it provides all the "obvious" configuration for a comfortable setup, without 32 | being so opinionated that it becomes a straight jacket. 33 | 34 | For deployment you get uberjar support, meaning you can get all your code 35 | compiled, optimized, and packaged in a single executable JAR file. It also 36 | contains the necessary artifacts to work on Heroku out of the box. 37 | 38 | **Need help?** Ask [on the mailing list](http://clojureverse.org/c/chestnut) 39 | (issues on GitHub are for bugs. Feature requests can be done either on the 40 | mailing list or on Github.) 41 | 42 | This README may describe unreleased features. Please compare the 43 | [version number on Clojars](https://clojars.org/chestnut/lein-template) to the 44 | [changelog below](https://github.com/plexus/chestnut/blob/master/README.md#changelog), 45 | and check the README in your generated project for instructions pertaining to 46 | your version. 47 | 48 | ## Usage 49 | 50 | **This README may describe unreleased features, instead you can check the [README for the latest stable release](https://github.com/plexus/chestnut/tree/v0.15.1/README.md)** 51 | 52 | ``` 53 | lein new chestnut 54 | 55 | e.g. 56 | 57 | lein new chestnut my-app +garden +reagent +http-kit 58 | ``` 59 | 60 | If you're using the snapshot version, then make sure to add a `--` to separate Leiningen's and Chestnut's arguments 61 | 62 | ``` 63 | lein new chestnut my-app --snapshot -- +garden +reagent +http-kit 64 | ``` 65 | 66 | You can get an overview of all recognized options with 67 | 68 | ``` 69 | lein new chestnut +help 70 | ``` 71 | 72 | After that open the README of your generated project for detailed instructions. 73 | 74 | ### Lighttable 75 | 76 | Lighttable provides a tighter integration for live coding with an inline 77 | browser-tab. Rather than evaluating cljs on the command line with weasel repl, 78 | evaluate code and preview pages inside Lighttable. 79 | 80 | Steps: After running `(go)`, open a browser tab in Lighttable. Open a cljs file 81 | from within a project, go to the end of an s-expression and hit Cmd-ENT. 82 | Lighttable will ask you which client to connect. Click 'Connect a client' and 83 | select 'Browser'. Browse to [http://localhost:10555](http://localhost:10555) 84 | 85 | View LT's console to see a Chrome js console. 86 | 87 | Hereafter, you can save a file and see changes or evaluate cljs code (without 88 | saving a file). Note that running a weasel server is not required to evaluate 89 | code in Lighttable. 90 | 91 | ### Emacs/Cider 92 | 93 | Start a repl in the context of your project with `M-x cider-jack-in`. 94 | 95 | After that it's the regular 96 | 97 | ``` 98 | (go) 99 | (cljs-repl) 100 | ``` 101 | 102 | as described above. 103 | 104 | ## List of Contents 105 | 106 | This template gives you everything you need to start developing 107 | Clojure/ClojureScript apps effectively. It comes with 108 | 109 | * [Figwheel](https://github.com/bhauman/lein-figwheel) Automatically reload your 110 | ClojureScript and CSS as soon as you save the file, no need for browser 111 | refresh. 112 | * A ClojureScript interface to Facebook's React. You can choose between 113 | Reagent (default), Om-next (`+om-next`), re-frame (`+re-frame`), 114 | Rum (`+rum`), or use `+vanilla` to do without a React wrapper. 115 | * [Ring](https://github.com/ring-clojure/ring) + Compojure. Clojure's de facto 116 | HTTP interface. Chestnut uses a Jetty or HttpKit server to serve the 117 | Clojurescript app. This way you already have an HTTP server running in case 118 | you want to add server-side functionality. Chestnut also inserts a Ring 119 | middleware to reload server-side Clojure files. 120 | * Heroku support. Chestnut apps have all the bits and pieces to be deployable to 121 | Heroku. Getting your app on the web is as simple as `git push`. 122 | * Unit tests for both Clojure and CLJS. Both specs and CLJS tests can be run in 123 | "auto" mode. 124 | 125 | ## Options 126 | 127 | General options: 128 | 129 | - `+help` Show an overview of all recognized options, then exit. 130 | - `+no-poll` Opt out of usage statistics poll. 131 | - `+http-kit` Use [HTTP Kit](http://http-kit.org/server.html) instead of Jetty. 132 | - `+bidi` Use [bidi](https://github.com/juxt/bidi) instead of Compojure. 133 | - `+site-middleware` Use the `ring.middleware.defaults.site-defaults` middleware (session, CSRF), instead of `ring.middleware.defaults.api-defaults` (see 134 | [ring.defaults documentation](https://github.com/ring-clojure/ring-defaults)). 135 | - `+code-of-conduct` / `+coc` Add the [contributor covenant](http://contributor-covenant.org/) Code of Conduct. 136 | - `+edge` Use the latest available version of all libraries/plugins. This includes alpha/beta versions, but does not include SNAPSHOT versions. 137 | - `+bleeding-edge` Like `+edge`, but also use SNAPSHOT versions when available. 138 | 139 | Choice of UI library: 140 | 141 | - `+vanilla` Don't include Reagent, use this if you intend to use some other view library. 142 | - `+om-next` Use om.next, instead of Reagent. 143 | - `+re-frame` Use Reagent and re-frame. 144 | - `+rum` Use Rum instead of Reagent. 145 | 146 | Choice of CSS style: 147 | 148 | - `+less` Use [less](https://github.com/montoux/lein-less) for compiling Less CSS files. 149 | - `+sass` Use SASS for generating CSS. 150 | - `+garden` Use Garden for generating CSS. 151 | 152 | ## Local copy 153 | 154 | If you want to customize Chestnut, or try unreleased features, you can 155 | run directly from master like this: 156 | 157 | ``` sh 158 | git clone https://github.com/plexus/chestnut.git 159 | cd chestnut 160 | lein install 161 | ``` 162 | 163 | Note that master may be partially or wholly broken. I try to do 164 | extensive manual testing before releasing a new stable version, so if 165 | you don't like surprises then stick to the version on Clojars. Issue 166 | reports and pull requests are very welcome. 167 | 168 | ## Requirements 169 | 170 | * Java 1.7 or later 171 | * Leiningen 2 172 | 173 | ## FAQ 174 | 175 | * **Q:** How can I get the features in the SNAPSHOT version?
176 | **A:** Use leiningen's `--snapshot` flag, e.g. `lein new chestnut 177 | my-project --snapshot` 178 | * **Q:** I'm seeing warnings while compiling ClojureScript.
179 | **A:** There are a few known warnings, but they should not affect the 180 | functioning of your app. 181 | * **Q:** I changed the `{:text "Hello Chestnut!"}` portion and saved 182 | the file, but the changes don't show up.
183 | **A:** It's a feature. The `app-state` is defined with `defonce`, so your 184 | application state doesn't reset every time you save a file. If you do 185 | want to reset after every change, change `(defonce app-state ..)` to 186 | `(def app-state ...)`. 187 | * **Q:** I just want to compile ClojureScript to fully optimized JavaScript, so 188 | I can use it in a static HTML site.
189 | **A:** Compile the "min" ClojureScript build, like this: `lein cljsbuild once min`, then look 190 | for `resources/public/js/app.js`. 191 | * **Q:** I gave my project a very generic name like `cljs` or `clojure` and now 192 | it's not working.
193 | **A:** This is due to namespace clashes. Try picking 194 | a more unique name. In particular avoid namespace prefixes used by 195 | Clojure, Clojurescript, or existing libraries. 196 | 197 | ## Sources 198 | 199 | I used the 200 | [browser-connected-repl](https://github.com/cemerick/austin/tree/master/browser-connected-repl-sample) 201 | that's included with [Austin](https://github.com/cemerick/austin) as a 202 | starting point, then pulled in bits from 203 | [cljs-liveedit-webapp](https://github.com/ejlo/cljs-liveedit-webapp) 204 | until things worked. Figwheel's 205 | [Flappy Bird Demo app](https://github.com/bhauman/flappy-bird-demo) 206 | also provided some ideas. The concept of refreshing Om when Figwheel 207 | reloads was taken from 208 | [this blog post](http://blog.michielborkent.nl/blog/2014/09/25/figwheel-keep-Om-turning/) 209 | by [Michiel Borkent](https://github.com/borkdude). 210 | 211 | For Heroku support I looked at Heroku's 212 | [clojure-getting-started](https://github.com/heroku/clojure-getting-started) 213 | example app. 214 | 215 | 216 | ## Other Templates 217 | 218 | We hope Chestnut is great for you, but there are also many other templates that tackle 219 | similar tasks.. Each has a slightly different perspective, so it is worth taking a look 220 | at a few. Here is a [comparison chart](https://goo.gl/ZZH8fm) of many interesting 221 | Clojure/ClojureScript templates. 222 | 223 | 224 | ## License 225 | 226 | Copyright © 2014-2018 Arne Brasseur 227 | 228 | Distributed under the Eclipse Public License either version 1.0 or (at 229 | your option) any later version. 230 | -------------------------------------------------------------------------------- /build_docs.sh: -------------------------------------------------------------------------------- 1 | early_exit() { 2 | echo "Your git repo isn't clean, refusing to continue" 3 | exit 1 4 | } 5 | 6 | git diff-index --quiet --cached HEAD && git diff-files --quiet || early_exit 7 | 8 | # npm -g install gitbook-cli && \ 9 | 10 | cd doc/ && \ 11 | echo "Building the book" && \ 12 | gitbook build && \ 13 | rm -rf /tmp/_book && \ 14 | mv _book /tmp && \ 15 | cd .. && \ 16 | echo "Overwriting gh-pages" &&\ 17 | git co gh-pages && \ 18 | rm -rf * && \ 19 | cp -r /tmp/_book/* . && \ 20 | git add -A && \ 21 | git commit -m 'update docs' && \ 22 | echo "Pushing to Github" && \ 23 | git push origin gh-pages:gh-pages && \ 24 | git co - 25 | -------------------------------------------------------------------------------- /code_of_conduct.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect 4 | all people who contribute through reporting issues, posting feature 5 | requests, updating documentation, submitting pull requests or patches, 6 | and other activities. 7 | 8 | We are committed to making participation in this project a 9 | harassment-free experience for everyone, regardless of level of 10 | experience, gender, gender identity and expression, sexual 11 | orientation, disability, personal appearance, body size, race, age, or 12 | religion. 13 | 14 | Examples of unacceptable behavior by participants include the use of 15 | sexual language or imagery, derogatory comments or personal attacks, 16 | trolling, public or private harassment, insults, or other 17 | unprofessional conduct. 18 | 19 | Project maintainers have the right and responsibility to remove, edit, 20 | or reject comments, commits, code, wiki edits, issues, and other 21 | contributions that are not aligned to this Code of Conduct. Project 22 | maintainers who do not follow the Code of Conduct may be removed from 23 | the project team. 24 | 25 | Instances of abusive, harassing, or otherwise unacceptable behavior 26 | may be reported by opening an issue or contacting one or more of the 27 | project maintainers. 28 | 29 | This Code of Conduct is adapted from the 30 | [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, 31 | available at 32 | [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | _book -------------------------------------------------------------------------------- /doc/01_00_getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | The only requirement for using Chestnut is that 4 | [Leiningen](http://leiningen.org/), version 2 or greater, is 5 | installed. Leiningen will take care of downloading Chestnut, Clojure, 6 | and other dependencies, so it's literally all you need. 7 | 8 | Leiningen and Clojure depend on Java, but chances are this will 9 | already be available on your system. You will need at least version 10 | 1.7. Oracle Java 1.8 is recommended. 11 | 12 | ## Creating the Application 13 | 14 | With Leiningen installed, open a terminal and type 15 | 16 | ``` sh 17 | lein new chestnut 18 | ``` 19 | 20 | This will create a directory with the name of your project, containing 21 | an application skeleton that you can fill in. This directory also 22 | contains a file named `README.md`. It has instructions on how to get 23 | started that are specific to the version of Chestnut you are 24 | using. Make sure to look at it! 25 | 26 | ## Quickstart for the Impatient 27 | 28 | If you want to see your application running as soon as possible, try this. 29 | 30 | In a terminal, start the Clojure REPL. 31 | 32 | ``` sh 33 | lein repl 34 | ``` 35 | 36 | Once you see the Clojure REPL prompt, `user=>`, type 37 | 38 | ``` 39 | (run) 40 | (browser-repl) 41 | ``` 42 | 43 | `(run)` will initiate the Clojurescript compilation, start a web 44 | server, and start the 45 | [Figwheel](https://github.com/bhauman/lein-figwheel) server to enable 46 | instant code reloading. 47 | 48 | `(browser-repl)` will change your Clojure REPL into a Clojurescript 49 | REPL. It needs a connection with a browser to be able to evaluate 50 | Clojurescript, so at this point it's waiting for a browser to connect 51 | to it. 52 | 53 | Once it seems everything has finished starting up and compiling, point 54 | your browser at [http://localhost:10555](http://localhost:10555). You 55 | should be seeing something like this: 56 | 57 | ![Screenshot: Hello Chestnut](img/hello_chestnut.png) 58 | -------------------------------------------------------------------------------- /doc/01_01_list_of_contents.md: -------------------------------------------------------------------------------- 1 | # List of Contents 2 | 3 | Chestnut mostly combines the work of others to give you everything you 4 | need. It's good to have a basic idea of what each of these does. 5 | 6 | ## React 7 | 8 | [React](http://facebook.github.io/react/) is a library for building 9 | user interfaces. It was created by Facebook to help them develop their 10 | applications. 11 | 12 | Its distinguising features are reactive data flow, and a virtual 13 | DOM. This means your UI automatically updates when your data 14 | changes. The virtual DOM lets React very efficiently figure out the 15 | changes in the UI. In React you define components that each render a 16 | piece of data. 17 | 18 | ## Om 19 | 20 | [Om](https://github.com/swannodette/om) provides a ClojureScript 21 | interface to React. By relying on Clojurescripts's persistent data 22 | structures it can be even faster than plain react. 23 | 24 | There are a few other Clojurescript wrappers for React, each with 25 | their merits. But if you're using Chestnut, you get Om. 26 | 27 | 28 | ## Figwheel 29 | 30 | [Figwheel](https://github.com/bhauman/lein-figwheel) powers the 31 | instant reloading of Clojurescript and CSS. When the application loads 32 | in the browser, it will connect to the Figwheel server. Whenever you 33 | save a Clojurescript or CSS file, Figwheel will recompile it, and send 34 | it to the browser. No page refresh required! 35 | 36 | ## Weasel 37 | 38 | In Clojure and other Lisps it's common to make heavy use of a REPL 39 | (read-eval-print-loop, i.e. a command line interface) during 40 | development. Evaluating Clojurescript requires a Javascript 41 | environment, such as provided by your browser. 42 | 43 | Weasel gives you a REPL for Clojurescript. It will wait for a browser 44 | to load and connect, so that it can send code to the browser to be 45 | evaluated. This way you can interact live with your running application. 46 | 47 | ## Ring 48 | 49 | Many web applications also have a server-side component, even for just 50 | an API. The HTML page containing the Clojurescript app also needs to 51 | be served from somewhere. There are a number of HTTP servers available 52 | for this. Chestnut gives you the choice between Jetty and HTTP Kit. 53 | 54 | [Ring](https://github.com/ring-clojure/ring) provides a common 55 | interface for your app to communicate with a web server. 56 | 57 | Ring also makes it easy to set up middleware that does extra 58 | processing as part of a web request/response cycle. Chestnut sets up a 59 | Ring middleware that handles hot reloading of server-side code. 60 | 61 | ## Compojure 62 | 63 | [Compojure](http://weavejester.github.io/compojure/) is a "concise 64 | routing library for Ring". It lets you configure request handlers 65 | based on HTTP method and URL patterns. 66 | 67 | ## Enlive 68 | 69 | [Enlive](https://github.com/cgrand/enlive) a selector based HTML 70 | templating and transformation system. We use this to inject some 71 | development workflow related bits into `index.html`. 72 | -------------------------------------------------------------------------------- /doc/01_02_invoking_chestnut.md: -------------------------------------------------------------------------------- 1 | # Invoking Chestnut 2 | 3 | Chestnut is a Leiningen template, you use it through the `lein new