【问题标题】:Launch ClojureScript + ghost script from terminal从终端启动 ClojureScript + ghost 脚本
【发布时间】:2017-07-04 07:35:46
【问题描述】:

我安装了phantomjscasperjs,使用lein new mies casper-ghost 创建了一个新项目,并将[ghost "0.1.0-alpha1] 依赖项添加到project.clj

然后我将示例代码从https://github.com/casperjs/ghost 复制到core.cljs 文件并成功编译它,使用./scripts/build

当我尝试使用 casperjs out/casper_ghost.js 运行它时,它给了我错误:

ClojureScript could not load :main, did you forget to specify :asset-path?
ReferenceError: Can't find variable: goog

  file:///usr/lib/node_modules/casperjs/bin/bootstrap.js:1 in global code

我尝试按如下方式创建自定义构建脚本:

(require 'cljs.build.api)

(cljs.build.api/build "src"
                      {:main 'hello-world.core
                       :output-to "out/main.js"})

并使用lein -m clojure.main build.clj 成功运行,但使用 casperjs 运行out/main.js 会导致同样的错误。

有人可以指出如何从 linux 终端运行 ghost 脚本的正确方向吗?

【问题讨论】:

    标签: terminal casperjs clojurescript


    【解决方案1】:

    通过在构建选项中使用:optimizations "simple",让 Google 闭包编译器将所有内容写入单个文件中就可以了。

    【讨论】:

      猜你喜欢
      • 2018-04-17
      • 1970-01-01
      • 2020-04-10
      • 1970-01-01
      • 2017-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-07
      相关资源
      最近更新 更多