Clojure Enlive模板-如何将脚本附加到页面末尾
我正在向我的页面添加自定义backbone.js脚本,它需要位于页面的末尾 我已经查看了向html头部添加脚本的解决方案,如下所述: 不幸的是,我需要在页面底部添加脚本Clojure Enlive模板-如何将脚本附加到页面末尾,clojure,enlive,Clojure,Enlive,我正在向我的页面添加自定义backbone.js脚本,它需要位于页面的末尾 我已经查看了向html头部添加脚本的解决方案,如下所述: 不幸的是,我需要在页面底部添加脚本 <html> <head><!-- all the normal css and js scripts--></head> <body> <div> <!-- html content that will be used b
<html>
<head><!-- all the normal css and js scripts--></head>
<body>
<div> <!-- html content that will be used by my scripts --> </div>
<!-- this is where i want to append custom javascripts -->
</body>
</html>
刚刚意识到它就像一个连体一样简单: 我的解决方案是非惯用的,我添加了很多印刷品来理解引擎盖下的内容;一旦我发现变压器的输入是一个向量,conj就成了一个显而易见的解决方案
(html/sniptest "<html><body><header class=\"some_class\">Header Content</header><footer>sddsd</footer></body></html>"
[:body] (fn [html-source]
(let [conts (:content html-source)
newstuff {:tag :script
:attrs {:src "../javascripts/foundation/foundation2.forms.js"}
:content []}
_ (pprint conts)
_ (print (class conts))
conts2 (conj conts newstuff )]
(assoc html-source :content conts2))))
(html/sniptest“Header contentsdsd”
[:body](fn[html源代码]
(let[conts(:内容html源)
newstuff{:tag:script
:attrs{:src../javascripts/foundation/foundation2.forms.js}
:content[]}
_(续)
_(印刷品(续)
conts2(conj conts newstuff)]
(关联html源代码:content conts2)))