From 740d2ebc12824e82344e697d0e8a4b4d8dbf00d2 Mon Sep 17 00:00:00 2001 From: Daniel Compton Date: Fri, 23 Feb 2018 11:44:33 +1300 Subject: [PATCH] Add docs explaining that :main is needed, or how to work around it --- README.md | 8 ++++++++ docs/Advanced-Setup.md | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docs/Advanced-Setup.md diff --git a/README.md b/README.md index c917aea..c19165b 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,13 @@ re-frame-10x configuration is per-project, only one person in your team needs to If you are using leiningen, modify `project.clj` in the following ways. When puzzling over the various possible leiningen configurations, it's often helpful to look at a sample [project.clj](https://github.com/technomancy/leiningen/blob/stable/sample.project.clj). +### IMPORTANT PREREQUISITES + +* You **must** have a [`:main`](https://clojurescript.org/reference/compiler-options#main) specified in your `:compiler` config for the `:preloads` and `:closure-defines` to take effect +* You **must** be running with the Closure define `goog.DEBUG` as false. This is the default under `:optimizations :none`. + +If you don't meet those pre-requisites, see the docs on [advanced setups](/docs/Advanced-Setup.md) for other ways to install re-frame-10x. + [![Clojars Project](https://img.shields.io/clojars/v/day8.re-frame/re-frame-10x.svg)](https://clojars.org/day8.re-frame/re-frame-10x) - Update your re-frame dependency to at least `0.10.5` - `[re-frame "0.10.5"]`. @@ -213,6 +220,7 @@ If you are using leiningen, modify `project.clj` in the following ways. When puz * Try a `lein clean` * Make sure you have followed all the installation steps. +* Make sure you have checked the [prerequisites](#important-prerequisites) ### If re-frame-10x throws an exception on startup diff --git a/docs/Advanced-Setup.md b/docs/Advanced-Setup.md new file mode 100644 index 0000000..67110ab --- /dev/null +++ b/docs/Advanced-Setup.md @@ -0,0 +1,14 @@ +# Advanced Setup + +If your project [does not use a `:main` config](../README.md#important-prerequisites) then you will need to do more work to setup your project. + +You need this JavaScript to be included on your page before you initialize your application: + +```js +var CLOSURE_UNCOMPILED_DEFINES = {"re_frame.trace.trace_enabled_QMARK_":true}; +document.write(''); + +// Must come before you initialize your application, but after `goog` and your other dependencies have been loaded. +``` + +This setup is inherently project specific, so open an issue if you have trouble, and we'll try and figure it out. Or if possible switch to using a `:main`.