是否可以在Clojurescript中使用Google Closure Templates?
我搜索过但没有找到相关信息。
是否可以在Clojurescript中使用Google Closure Templates?
我搜索过但没有找到相关信息。
由于Soy模板被编译成JavaScript函数,因此您应该能够毫无问题地使用它。请查看这里以获取有关如何在ClojureScript中使用外部JavaScript库的通用说明:
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
您还应该使用此标志编译模板:--shouldProvideRequireSoyNamespaces
,请查看此处获取更多信息。
(ns foo.bar
(:require [goog.dom :as dom]))
<script type="text/javascript" src="js/compiled.js"></script>
<script type="text/javascript">
goog.require('foo.bar');
</script>
TwitterBuzz示例很好地展示了这一点。