Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use cljs.closure/set-options for command-line flags

  • Loading branch information...
commit 16166b817a0eb745fe07999ae2cbf83e00f5372a 1 parent fc75b64
Chris Houser Chouser authored
Showing with 7 additions and 9 deletions.
  1. +1 −2  samples/nodehello.cljs
  2. +6 −7 src/clj/cljs/closure.clj
3  samples/nodehello.cljs
View
@@ -9,8 +9,7 @@
; Compile this using a command line like:
CLOJURESCRIPT_HOME=".../clojurescript/" \
- bin/cljsc samples/nodehello.cljs \
- {:optimizations :simple :pretty-print true :target :nodejs} \
+ bin/cljsc samples/nodehello.cljs {:target :nodejs} \
> out/nodehello.js
; Then run using:
13 src/clj/cljs/closure.clj
View
@@ -75,9 +75,11 @@
(defn set-options
"TODO: Add any other options that we would like to support."
[opts ^CompilerOptions compiler-options]
- (doseq [flag (:flags opts)]
- (case flag
- :pretty-print (set! (. compiler-options prettyPrint) true))))
+ (when (contains? opts :pretty-print)
+ (set! (.prettyPrint compiler-options) (:pretty-print opts)))
+ (when (contains? opts :print-input-delimiter)
+ (set! (.printInputDelimiter compiler-options)
+ (:print-input-delimiter opts))))
(defn make-options
"Create a CompilerOptions object and set options from opts map."
@@ -88,9 +90,6 @@
:simple CompilationLevel/SIMPLE_OPTIMIZATIONS)
compiler-options (doto (CompilerOptions.)
(.setCodingConvention (ClosureCodingConvention.)))]
- (when (:pretty-print opts)
- (set! (.printInputDelimiter compiler-options) true)
- (set! (.prettyPrint compiler-options) true))
(do (.setOptionsForCompilationLevel level compiler-options)
(set-options opts compiler-options)
compiler-options)))
@@ -483,7 +482,7 @@
;; optimize a project
(println (->> (-compile "samples/hello/src" {})
(apply add-dependencies {})
- (apply optimize {:optimizations :simple :flags #{:pretty-print}})))
+ (apply optimize {:optimizations :simple :pretty-print yes})))
)
;; Output
Please sign in to comment.
Something went wrong with that request. Please try again.