Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Permit hashbang omission for nodejs target.

Adding :hashbang false to the compiler build options will
omit the hashbang.
  • Loading branch information...
commit 00a9b7bde0c8823175560b453a00e7be09ddd250 1 parent 87deb8b
@grzm grzm authored swannodette committed
Showing with 9 additions and 1 deletion.
  1. +1 −1  src/clj/cljs/closure.clj
  2. +8 −0 test/clj/cljs/closure_tests.clj
View
2  src/clj/cljs/closure.clj
@@ -510,7 +510,7 @@
(str (apply str (map #(slurp (io/resource %)) paths)) "\n"))
(defn make-preamble [{:keys [target preamble hashbang]}]
- (str (when (= :nodejs target)
+ (str (when (and (= :nodejs target) (not (false? hashbang)))
(str "#!" (or hashbang "/usr/bin/env node") "\n"))
(when preamble (preamble-from-paths preamble))))
View
8 test/clj/cljs/closure_tests.clj
@@ -11,6 +11,14 @@
(testing "with custom hashbang"
(is (= "#!/bin/env node\n" (make-preamble {:target :nodejs
:hashbang "/bin/env node"}))))
+ (testing "with no hashbang"
+ (is (= "" (make-preamble {:target :nodejs
+ :hashbang false})))
+ (testing "and preamble"
+ (is (= "var preamble1 = require(\"preamble1\");\n"
+ (make-preamble {:target :nodejs
+ :hashbang false
+ :preamble ["cljs/preamble1.js"]})))))
(testing "with preamble"
(is (= "#!/usr/bin/env node\nvar preamble1 = require(\"preamble1\");\n"
(make-preamble {:target :nodejs
Please sign in to comment.
Something went wrong with that request. Please try again.