为什么 cljsbuild
无法正确编译 gulpfile.js
文件?
这是我 project.clj
的配置:
(defproject cljs-selfstudy "0.1.0-SNAPSHOT"
:description "Where I want to learn about clojurescript"
:url "http://example.com"
:dependencies [[org.clojure/clojure "1.7.0-alpha2"]
[org.clojure/clojurescript "0.0-2322"]]
:plugins [[lein-cljsbuild "1.0.4-SNAPSHOT"]]
:source-paths ["src"]
:cljsbuild {
:builds [{:id "gulpjs"
:source-paths ["src/gulpjs"]
:compiler {
:output-to "gulpfile.js"
:optimizations :none
:pretty-print true}}]})
这是我的
core.cljs
文件。(ns gulpjs.core
(:require [cljs.nodejs :as node]))
(def gulp (node/require "gulp"))
(def gulp-livereload (node/require "gulp-livereload"))
(def gulp-markdown (node/require "gulp-markdown"))
(def gulp-watch (node/require "gulp-watch"))
(.task gulp "markdown"
#(-> (.source gulp "../markdown-explained")
(.pipe (gulp-markdown))
(.pipe (.dest gulp "build/markdown-explained"))))
这是我用来编译的命令
lein cljsbuild once gulpjs
Compiling ClojureScript.
Compiling "gulpfile.js" from ["src/gulpjs"]...
Successfully compiled "gulpfile.js" in 3.316 seconds.
但是我有一个奇怪的输出 gulpfile.js
,它看起来根本不像 Node 代码,为什么会这样错呢???
goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.object', 'goog.string.StringBuffer', 'goog.array']);
goog.addDependency("../cljs/nodejs.js", ['cljs.nodejs'], ['cljs.core']);
goog.addDependency("../gulpjs/core.js", ['gulpjs.core'], ['cljs.core', 'cljs.nodejs']);