【发布时间】:2016-12-09 05:11:58
【问题描述】:
如何配置 project.clj 文件以将其配置为在编译时从打嗝和花园输出 html 和 css 文件,以便我可以部署到服务器而无需在客户端加载任何动态 css/html?
【问题讨论】:
标签: clojure clojurescript hiccup
如何配置 project.clj 文件以将其配置为在编译时从打嗝和花园输出 html 和 css 文件,以便我可以部署到服务器而无需在客户端加载任何动态 css/html?
【问题讨论】:
标签: clojure clojurescript hiccup
如果您真的不需要使用 Leiningen,使用 Boot 您可以使用 perun.io 轻松完成,特别是如果网站是主要目标:
https://perun.io/guides/getting-started/
https://github.com/hashobject/perun.
我以这种方式重写了我的网站https://github.com/ArchieT/website-archiet。
如果有需要使用 Lein,也许我会稍后再看,因为我现在没有太多时间。
应该不难做到。
【讨论】:
您可以使用lein-garden leiningen 插件:https://github.com/noprompt/lein-garden。
这是一个示例配置。
(defproject cash-money "1.1.1"
:plugins [[lein-garden "X.X.X"]]
:garden {:builds [{;; Optional name of the build:
:id "screen"
;; Source paths where the stylesheet source code is
:source-paths ["src/styles"]
;; The var containing your stylesheet:
:stylesheet cash-money.core/screen
;; Compiler flags passed to `garden.core/css`:
:compiler {;; Where to save the file:
:output-to "resources/screen.css"
;; Compress the output?
:pretty-print? false}}]})
然后你可以运行lein garden auto 来观察变化并自动重新编译。
如果您想要使用此代码库的示例:https://github.com/Dexterminator/spotify-data-extrapolator/tree/db8d6e16529940272409598c8ac0fdbbaf739646
为了帮助您将来找到类似的东西,我将描述一个发现过程。
我通过访问 garden github 存储库 (https://github.com/noprompt/garden) 并查看代码中的一些文本找到了这一点,这些文本看起来像是 garden 独有的,这样我就可以搜索所有 github 和查找使用 garden 的其他存储库。我选择的文字是defpseudoelement。我扫描了已经在使用garden 的项目,并在自述文件中找到了一个提到运行lein garden auto 的项目。再次搜索lein garden auto 将我带到lein-garden leiningen 插件。事后看来,看看garden 的作者写的其他库可能更有意义。那将直接将我们带到插件。生活吧。
【讨论】: