Skip to content
This repository

Create a mechanism to declare externs in server config. #125

Open
wants to merge 1 commit into from

1 participant

Brian Rowe
Brian Rowe

This is the code portion of a solution to issue #65.

I added a mechanism that enables developers to declare externs in their
server's config.clj. I also demonstrated a use of the mechanism. I
included the client javascript for the BrowserID login system.

Brian Rowe briprowe Create a mechanism to declare externs in server config.
Also, demonstrate how to include javascript to do BrowserID logins.
91fde6b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 20, 2012
Brian Rowe briprowe Create a mechanism to declare externs in server config.
Also, demonstrate how to include javascript to do BrowserID logins.
91fde6b
This page is out of date. Refresh to see the latest.
4 externs/browserid.js
... ... @@ -0,0 +1,4 @@
  1 +var navigator = {};
  2 +navigator.id = {};
  3 +navigator.id.getVerifiedEmail = function() {};
  4 +
2  src/app/clj/one/sample/config.clj
@@ -14,6 +14,8 @@
14 14 :js "public/javascripts"
15 15 :dev-js-file-name "main.js"
16 16 :prod-js-file-name "mainp.js"
  17 + :externs-root "externs"
  18 + :externs ["browserid.js"]
17 19 :dev-js ["goog.require('one.sample.core');"
18 20 "goog.require('one.sample.model');"
19 21 "goog.require('one.sample.controller');"
6 src/lib/clj/one/config.clj
@@ -15,3 +15,9 @@
15 15 Javascript file."
16 16 [config]
17 17 (str (:js config) "/" (:prod-js-file-name config)))
  18 +
  19 +(defn externs
  20 + [config]
  21 + (let [root (:externs-root config)]
  22 + (for [file (:externs config)]
  23 + (str root "/" file))))
5 src/lib/clj/one/tools.clj
@@ -2,7 +2,7 @@
2 2 "Support for building deployment artifacts for a project."
3 3 (:use [cljs.closure :only (build)]
4 4 [one.host-page :only (application-host)]
5   - [one.config :only (cljs-build-opts production-js)]
  5 + [one.config :only [cljs-build-opts production-js externs]]
6 6 [cljs.repl :only (repl)]
7 7 [cljs.repl.browser :only (repl-env)])
8 8 (:require [clojure.java.io :as io]))
@@ -13,7 +13,8 @@
13 13 [config]
14 14 (build (:app-root config) (assoc (cljs-build-opts config)
15 15 :optimizations :advanced
16   - :output-to (str "out/" (production-js config))))
  16 + :output-to (str "out/" (production-js config))
  17 + :externs (externs config)))
17 18 (spit "out/public/index.html" (application-host config :production)))
18 19
19 20 (defn cljs-repl
1  templates/application.html
@@ -49,5 +49,6 @@
49 49
50 50 </div> <!-- /container -->
51 51
  52 + <script src="https://browserid.org/include.js" type="text/javascript"></script>
52 53 </body>
53 54 </html>

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.