ClojureScript

Add support for Closure defines

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

The Closure compiler has "--define" which allows you to set some library values at compile time. The settable values are annotated with "@define": https://code.google.com/closure/compiler/docs/js-for-compiler.html

The particular values I was interested in were goog.dom.ASSUME_{QUIRKS,STANDARDS}_MODE because it would save some code and runtime computation if the rendering mode is known at compile time. (It turns out to be very minor for my tiny test program, but probably more substantial for things that use more of the Closure library.) goog.DEBUG also seems useful to tweak.

The attached patch supports a new compile option :define, along with a map from keys/strings to values. The Closure compiler takes a -define option like: "-define='goog.DEBUG=false'". In ClojureScript, this would be {:define {"goog.DEBUG" false}} or {:define {:goog.DEBUG false}}.

Activity

David Nolen made changes -
Field Original Value New Value
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

  • Assignee:
    Unassigned
    Reporter:
    John Li
Vote (3)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: